iOS:整页插页式广告在关闭后显示黑屏

时间:2014-11-17 03:28:35

标签: ios xcode iad interstitial

我使用此代码显示全屏广告,其中显示整页广告。问题是,当我关闭广告时,我只有一个空白屏幕。它不再显示我的应用程序了。

我的代码:

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

1 个答案:

答案 0 :(得分:1)

找到解决方案。当广告关闭时,我只需要再次呈现我的视图控制器。我使用了以下代码:

-(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];

}