iOS:在对新的viewController执行segue时添加非页内广告?

时间:2014-09-05 13:16:46

标签: ios objective-c segue iad

我想在故事板中的viewControllers之间执行segue后立即显示插页式广告(来自iAd框架)。

我尝试启动[interstitial presentInView:view](如Apple文档中所述),但广告未显示。

任何帮助?

1 个答案:

答案 0 :(得分:1)

最后,我设法解决了我的疑问。

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

-(void) interstitialAdDidLoad:(ADInterstitialAd *)interstitialAd{
    NSLog(@"interstitialAd DidLOAD");
    if (interstitialAd != nil && interstitial != nil && requestingAd == YES) {
        NSLog(@"interstitialDidPRESENT");
        [interstitial presentFromViewController:self];
    }
}