iAD视图冻结广告closures

好吧,所以在模拟器上testing后,事实certificate,这个问题只发生在实际的设备上 …我将如何解决这个问题?


我正在使用SpriteKit制作iOS应用程序,并正在实施iAD。 除了一件事之外,一切都或多或less地像我所期望的那样。 当我点击广告时,就像预期的那样,我把广告带到了一个全屏广告,但是当我closures那个广告时,当前视图冻结了,因为在视觉上什么也没有发生。 我知道该应用程序仍在运行,因为当我再次点击横幅广告并再次closures时,游戏恢复正常,游戏在视觉上冻结时进展。 这是如何在我的视图控制器类(iAD委托)初始化横幅:

self.canDisplayBannerAds = YES; CGRect bannerFrame = CGRectMake(0, 20, scene.size.width, 50); banner = [[ADBannerView alloc] initWithAdType:ADAdTypeBanner]; banner.delegate = self; banner.frame = bannerFrame; [banner setAlpha:0]; [self.view addSubview:banner]; 

这些也是视图控制器类中的加载方法:

 - (void) bannerViewDidLoadAd:(ADBannerView *) bannerM { NSLog(@"Ad Loaded"); [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:1]; [bannerM setAlpha:1]; [UIView commitAnimations]; } - (void) bannerView:(ADBannerView *)bannerM didFailToReceiveAdWithError:(NSError *)error { NSLog(@"Ad Failed"); [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:1]; [bannerM setAlpha:0]; [UIView commitAnimations]; } 

我真的不明白这个问题或为什么发生…任何帮助将不胜感激!

谢谢,
StrongJoshua

编辑以下是横幅广告打开和closures时调用的两种方法:

 - (BOOL) bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave { if(playing) { NSLog(@"Ad Pause"); SKView *v = (SKView *)self.view; NSLog(@"2"); SKScene *s = (SKScene *)v.scene; NSLog(@"3"); WBPlayScene *p = (WBPlayScene *) s; NSLog(@"4"); [p.logic pause:YES]; NSLog(@"Done"); } return YES; } - (void) bannerViewActionDidFinish:(ADBannerView *)banner { if(playing) { NSLog(@"Ad Unpause"); [((WBPlayScene *)((SKView *)self.view).scene).logic pause:NO]; } } 

固定所有这些NSLogs的原因是因为游戏崩溃,当我试图暂停它。 游戏在达到“2”后崩溃,所以在SKScene *s = (SKScene *)v.scene; 。 它给出错误[UIView scene]: unrecognized selector sent to instance ,我不明白为什么… 解决scheme:为了解决这一问题,我改self.originalContentView ,它得到了SKView而不是广告横幅的视图。

非常感谢您的帮助!

解决:我不得不删除调用,以启用广告显示self.canDisplayBannerAds因为它干扰我自己创build的横幅。