【发布时间】:2016-04-08 06:36:04
【问题描述】:
我有一个带计时器的小游戏。 我正在实施 adMob 以获利,但在用户点击横幅并返回应用后,我无法重新启动计时器/广告。
流程是:
- 1 - 游戏开始
- 2 - 展示广告
- 3 - 点击横幅并暂停计时器
- 4 - Opera safari
- 5 - 点击“返回我的应用”链接/按钮(iOS 功能)
- 6 - 返回应用并重新启动计时器(此处有问题)
我已经实现了所有 adMob 事件方法(并插入了重新启动计时器代码),但我无法摆脱这个问题。 该代码有效,因为它与 iAds 一起使用(我正在迁移到 adMob)。
感谢任何帮助。 谢谢
编辑: 这是代码:
/// Tells the delegate an ad request loaded an ad.
- (void)adViewDidReceiveAd:(GADBannerView *)adView {
NSLog(@"adViewDidReceiveAd");
self.pauseTimer = NO;
}
/// Tells the delegate an ad request failed.
- (void)adView:(GADBannerView *)adView
didFailToReceiveAdWithError:(GADRequestError *)error {
NSLog(@"adView:didFailToReceiveAdWithError: %@", [error localizedDescription]);
self.pauseTimer = NO;
}
/// Tells the delegate that a full screen view will be presented in response
/// to the user clicking on an ad.
- (void)adViewWillPresentScreen:(GADBannerView *)adView {
NSLog(@"adViewWillPresentScreen");
self.pauseTimer = NO;
}
/// Tells the delegate that the full screen view will be dismissed.
- (void)adViewWillDismissScreen:(GADBannerView *)adView {
NSLog(@"adViewWillDismissScreen");
self.pauseTimer = NO;
}
/// Tells the delegate that the full screen view has been dismissed.
- (void)adViewDidDismissScreen:(GADBannerView *)adView {
NSLog(@"adViewDidDismissScreen");
self.pauseTimer = NO;
}
/// Tells the delegate that a user click will open another app (such as
/// the App Store), backgrounding the current app.
- (void)adViewWillLeaveApplication:(GADBannerView *)adView {
NSLog(@"adViewWillLeaveApplication");
self.pauseTimer = YES;
}
【问题讨论】:
-
发布 AdMob 事件方法的代码,以便我们了解发生了什么。看起来事件正在返回应用程序,所以您需要应用程序委托方法而不是 AdMob 事件方法
-
@noobsmcgoobs 非常感谢您的回复/支持。我整夜都在上面。我编辑并添加了代码...
-
我刚刚给出了答案。试一试,看看它是否适合你。如果没有,我可以提供另一个答案。
-
@noobsmcgoobs 天哪!
-
@noobsmcgoobs 但是否有对应于 -(void)bannerViewActionDidFinish:(ADBannerView *)banner 和 -(BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave 的内容?因为在 iAds 中我使用这种方法来暂停和重新启动计时器。 :(