如果我们在解雇Google移动广告_689811后尝试提供视图,则iOS应用会崩溃 .
模拟器版本:iOS 7.1(4英寸64位)Google移动广告SDK版本:6.9.2
用于呈现启动广告的代码(应用程序:didFinishLaunchingWithOptions :):
InitialSlidingViewController *controller = [[InitialSlidingViewController alloc] init];
[self.window setRootViewController:controller];
splashInterstitial_ = [[DFPInterstitial alloc] init];
splashInterstitial_.adUnitID = SplashInterstitialID;
GADRequest *request = [GADRequest request];
splashInterstitial_.delegate = self;
request.testDevices = [NSArray arrayWithObjects:GAD_SIMULATOR_ID, nil];
[splashInterstitial_ loadAndDisplayRequest:request
usingWindow:window_
initialImage:[UIImage imageNamed:imageName]];
[self.window setBackgroundColor:[UIColor blackColor]];
[self.window makeKeyAndVisible];
使用代理方法
- (void)interstitial:(DFPInterstitial *)interstitial didFailToReceiveAdWithError:(GADRequestError *)error {
//present a view
}
- (void)interstitialDidDismissScreen:(GADInterstitial *)ad {
ad.delegate = nil;
splashInterstitial_.delegate = nil;
ad = nil;
splashInterstitial_ = nil;
//Present a view controller
}
用于呈现视图的代码
NewViewController *newVC = [[NewViewController alloc] initWithNibName:@"NewViewController" bundle:nil];
UINavigationController *nav = [[PortraitNavController alloc] initWithRootViewController:newVC];
nav.navigationBarHidden = YES;
[self.navigationController presentViewController:nav animated:YES completion:nil];
//从控制台崩溃日志:
- [GADWebAppViewController isKindOfClass:]:发送到解除分配的实例0x573efe90的消息
1 回答
通过将用于呈现插页式广告的代码移动到
Rootviewcontroller
来解决此问题 . 建议在Google Ads Developer official blog中使用此解决方案 .imageView_
是一个全屏图像视图,包含相同的闪屏图像 .