Reputation: 10101
Using the iOS example project 2.5: http://google-mobile-dev.googlecode.com/files/InterstitialExample_iOS_2.5.zip
In the MainController.m
, I add two methods in order to invoke the showInterstitial
such that every time when the app enter foreground from background, e.g.
- (void) viewDidLoad {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillEnterForegroundNotification) name:UIApplicationWillEnterForegroundNotification object:nil];
}
- (void) appWillEnterForegroundNotification{
[self showInterstitial:nil];
}
The first method is for registration the callback for the view controller to receive enter foreground notification, and the second method invoke the showInterstitial
method when that happen. I can see the method showInterstitial
is really called and request really fired, but there is no success or error callback being invoked.
Any idea?
Upvotes: 2
Views: 1038
Reputation: 3251
That's probably not the right time to display the interstitial. You want the application to be active again, not about to be active.
Try it from - (void)applicationDidBecomeActive:(UIApplication *)application
Upvotes: 4