不显示插页式广告。
Interstitial don't appear.
我使用此代码添加插页式广告:
- (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.
知道为什么吗?在其他应用程序中它可以工作。
在我的 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];
}
我使用此代码添加插页式广告:
- (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.
知道为什么吗?在其他应用程序中它可以工作。
在我的 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];
}