如果我在广告有时间打开 Safari 或 AppStore之前点击全屏广告并将其关闭,则应用程序崩溃,并出现以下错误:
[RevMob] Initializing Fullscreen.
[RevMob] Ad received: (200).
[RevMob] Fullscreen clicked.
[RevMob] Loading iTunes url.
[RevMob] Fullscreen closed.
[RevMob] Opening iTunes.
***** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'**
如果有一个加载屏幕来阻止用户交互,而 RevMob 采取的行动是不会发生的……我试图用加载屏幕覆盖广告,但我无法做到这一点……有什么解决方案那?
--
我有 2 个 iVar 来控制 revMob:
RevMobFullscreen* _revMobFullScreen;
BOOL _revMobFullScreenLoaded;
我以这种方式预加载全屏广告:
- (void)cacheFullScreenRevMob{
//Get rid of old fullscreen ad and create a new one
//This is need in order to (re)load an fullscreen ad
[_revMobFullScreen release], _revMobFullScreen = nil;
_revMobFullScreen = [[RevMobAds session] fullscreen];
[_revMobFullScreen retain];
//Pre load the ad for the next time
_revMobFullScreenLoaded = NO;
[_revMobFullScreen loadWithSuccessHandler:^(RevMobFullscreen *fs) {
_revMobFullScreenLoaded = YES;
} andLoadFailHandler:^(RevMobFullscreen *fs, NSError *error) {
_revMobFullScreenLoaded = NO;
} onClickHandler:nil onCloseHandler:^{
[self postNotificationOnMainThreadFullAdDidFinish];
}];
}
然后,这就是我显示全屏 revmob 广告的方式:
- (BOOL)showFullScreenRevMob{
BOOL didShow = NO;
if (_revMobFullScreenLoaded) {
[_revMobFullScreen showAd];
didShow = YES;
}
//Cache for the next time
[self cacheFullScreenRevMob];
return didShow;
}