插页式广告不会出现。

时间:2015-02-09 17:00:44

标签: ios objective-c interstitial

我使用此代码添加插页式广告:

    - (void)applicationDidBecomeActive:(UIApplication *)application
{
    GADRequest *request = [GADRequest request];

    request.testDevices = [NSArray arrayWithObjects:
                           GAD_SIMULATOR_ID,
                           nil];



    gadinter = [[GADInterstitial alloc] init];
    gadinter.delegate = self;
    gadinter.adUnitID = @"ca-app-pub-8360827428091030/4165686904";

    [gadinter loadRequest:request];
}

- (void)interstitialDidReceiveAd:(GADInterstitial *)interstitial {

    [gadinter presentFromRootViewController:self.window.rootViewController];
}

我得到了这个:

2015-02-09 18:57:12.636 iStrobe[5951:1824030] <Google> Cannot present interstitial. It is not ready. 2015-02-09 18:57:13.801 iStrobe[5951:1824030] <Google> No UIViewController supplied to the ad. Cannot continue.

任何想法为什么?在其他应用程序中,它可以工作。

1 个答案:

答案 0 :(得分:0)

在我的viewController中我添加了它:

- (void)viewDidLoad {


    GADRequest *request = [GADRequest request];

    request.testDevices = [NSArray arrayWithObjects:
                           GAD_SIMULATOR_ID,
                           nil];



    gadinter = [[GADInterstitial alloc] init];
    gadinter.delegate = self;
    gadinter.adUnitID = @"ca-app-pub-8360827428091030/4165686904";

    [gadinter loadRequest:request];

}

- (void)interstitialDidReceiveAd:(GADInterstitial *)interstitial {
    [gadinter presentFromRootViewController:self];
}
相关问题