【发布时间】:2018-07-05 15:38:24
【问题描述】:
我尝试为我的一个应用程序集成 GoogleAdMob - 插页式广告。 在这里展示。
interstitial:didFailToReceiveAdWithError: Request Error: No ad to show.
Ad wasn't ready
在 AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[GADMobileAds configureWithApplicationID:@"AppID Value"];
return YES;
}
在视图控制器上
static NSString *const GADAdUnitID = @"ADUnitId Value";
#pragma mark - googleAdsMobile
- (GADInterstitial *)createAndLoadInterstitial {
GADInterstitial *interstitial =
[[GADInterstitial alloc] initWithAdUnitID:GADAdUnitID];
interstitial.delegate = self;
GADRequest *request = [GADRequest request];
request.testDevices = @[ @"some value"];
[interstitial loadRequest:request];
return interstitial;
}
/// Tells the delegate an ad request succeeded.
- (void)interstitialDidReceiveAd:(GADInterstitial *)ad {
NSLog(@"interstitialDidReceiveAd");
}
/// Tells the delegate an ad request failed.
- (void)interstitial:(GADInterstitial *)ad
didFailToReceiveAdWithError:(GADRequestError *)error {
NSLog(@"interstitial:didFailToReceiveAdWithError: %@", [error localizedDescription]);
}
/// Tells the delegate that an interstitial will be presented.
- (void)interstitialWillPresentScreen:(GADInterstitial *)ad {
NSLog(@"interstitialWillPresentScreen");
}
/// Tells the delegate the interstitial is to be animated off the screen.
- (void)interstitialWillDismissScreen:(GADInterstitial *)ad {
NSLog(@"interstitialWillDismissScreen");
}
/// Tells the delegate the interstitial had been animated off the screen.
- (void)interstitialDidDismissScreen:(GADInterstitial *)ad {
NSLog(@"interstitialDidDismissScreen");
self.interstitial = [self createAndLoadInterstitial];
}
/// Tells the delegate that a user click will open another app
/// (such as the App Store), backgrounding the current app.
- (void)interstitialWillLeaveApplication:(GADInterstitial *)ad {
NSLog(@"interstitialWillLeaveApplication");
}
应用程序上没有展示广告。
我是否需要付费订阅 googleAdMob 才能展示广告?
在与 Firebase 链接后,我在 Ads 上方找到了 Admob 谷歌。但我还没有看到真正的广告。我很困惑我错过了什么让应用程序在 iPhone 设备上运行真实的广告。
一旦来自 AdMob 的插页式测试广告显示提示以下消息。
_userSettingsForUser mobile: {
filterBlacklist = (
);
filterWhitelist = (
);
restrictWeb = 1;
useContentFilter = 0;
useContentFilterOverrides = 0;
whitelistEnabled = 0;
}
我期待这里有一个真正的广告。
【问题讨论】:
标签: ios objective-c admob interstitial google-admob