我已经在我的 iOS 应用程序中实现了 Admob。横幅、奖励视频和中介插页式广告(Admob、Unity 和 Chartboost)。我唯一的问题是应用程序总是在展示 3-4 个插页式广告后崩溃。调试器显示此消息:Message from debugger: Terminated due to memory issue
。
我 100% 确定崩溃来自插页式广告。我已经测试完全没有广告,没有崩溃。而且只有横幅广告,没有崩溃。
这是我用来实施和展示插页式广告的代码:
@interface ViewController ()
@property(nonatomic, strong) GADInterstitial *interstitial;
@end
- (void)viewDidLoad {
[self loadInterstitial];
}
- (void)loadInterstitial {
self.interstitial = [[GADInterstitial alloc] initWithAdUnitID:@"ca-app-pub-xxxxx/xxxxx"];
self.interstitial.delegate = self;
[self.interstitial loadRequest:[GADRequest request]];
}
- (void)interstitialDidDismissScreen:(GADInterstitial *)interstitial {
[self loadInterstitial];
}
- (void)someMethod {
if (self.interstitial.isReady) {
[self.interstitial presentFromRootViewController:self];
}
}