簡體   English   中英

iOS:整頁插頁式廣告在關閉后顯示黑屏

[英]iOS: full page interstitial ad shows black screen after close

我使用此代碼顯示全屏廣告,其中顯示整頁廣告。 問題是,當我關閉廣告時,我只有一個空白屏幕。 它不再顯示我的應用程序了。

我的代碼:

-(void)showFullScreenAd {
    if (requestingAd == NO) {
        interstitial = [[ADInterstitialAd alloc] init];
        interstitial.delegate = self;
        self.interstitialPresentationPolicy = ADInterstitialPresentationPolicyManual;
        [self requestInterstitialAdPresentation];
        NSLog(@"interstitialAdREQUEST");
        requestingAd = YES;
    }
}

找到了解決方案。 當廣告關閉時,我只需要再次呈現我的視圖控制器。 我使用了以下代碼:

-(void)interstitialAdActionDidFinish:(ADInterstitialAd *)interstitialAd {
    interstitial = nil;
    requestingAd = NO;
    NSLog(@"interstitialAdDidFINISH");

    // present my view controller again
    ViewController *myVC = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
    [self presentViewController:myVC animated:YES completion:nil];

}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM