iOS: full page interstitial ad shows black screen

2019-07-06 20:12发布

问题:

I show a full screen advertisement with this code, which works showing a full page advertisement. The problem is that when I close the advertisement I just have a blank screen. It does not show my app anymore.

My code:

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

回答1:

Found a solution. I just needed to present my view controller again when the advertisement had been closed. I used the following code:

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

}