我遇到了一个问题,即 Admob 横幅显示,但是,当您点击它时,它要么使应用程序崩溃,要么什么都不做。
它使用admob中介,与iAd分开,如果显示iAd,可以点击它没有问题...
- (void) onEnter {
if (![MKStoreManager featureAPurchased])
{
controller = [[RootViewController alloc]init];
bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeSmartBannerPortrait];
bannerView_.adUnitID = MY_BANNER_UNIT_ID;
CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat screenWidth = screenRect.size.width;
CGFloat screenHeight = screenRect.size.height;
CGFloat screenXPos = (screenWidth /2);
CGFloat screenYPos = screenHeight - 25;
[bannerView_ setCenter:CGPointMake(screenXPos, screenYPos)];
bannerView_.rootViewController = controller;
bannerView_.adUnitID = MY_BANNER_UNIT_ID;
bannerView_.rootViewController = controller;
[[[CCDirector sharedDirector]view] addSubview: bannerView_];
[bannerView_ loadRequest:[GADRequest request]];
}else{
bannerView_.hidden = YES;
}
错误是如果我尝试点击横幅没有任何反应,并且在控制台中我看到以下错误;
Attempt to present <GADBrowserController: 0x1d576ca0> on <RootViewController: 0x1e8ed3f0> whose view is not in the window hierarchy!
将不胜感激任何帮助