I would like to add some ads in my application, and especially an interstitial when the app enter foreground.
I've created this method in my AppDelegate.m:
- (void)splashInterstitial
{
UIImage *image;
if (TEST_IPHONE_5) {
image = [UIImage imageNamed:@"Default-568h.png"];
} else {
image = [UIImage imageNamed:@"Default.png"];
}
splashInterstitial_ = [[DFPInterstitial alloc] init];
splashInterstitial_.adUnitID = ADMOBS_OUVERTURE;
[splashInterstitial_ loadAndDisplayRequest:[GADRequest request]
usingWindow:self.window
initialImage:image];
}
I call it twice :
- in application:didFinishLaunchingWithOptions:
- in applicationWillEnterForeground:
It works fine when called in application:didFinishLaunchingWithOptions:
, but in the second case, I have this error :
Google Request Error: The Google Ad request was unable to be fulfilled before a timeout occurred.
Obviously, it needs 5 seconds to load, but I can't figure out how to force my application to wait for it.
Does anyone knows how to do that ?
Thanks for your help.