I have an iAd which shows up fine when connected to the Network. On the iOS simulator or testing on my device, if I open up my app, see the iAd, then go to settings and turn on airplane mode, and return to the app, the banner slide off the screen. Great. Now, if I turn airplane mode back off (network is ON), the iAd doesn’t reappear – even after waiting for 10-15 minutes.
So, here are my questions:
-
Does the iAd Test Advertisement refresh itself the same as a real iAd would (every minute or so)?
-
Is there a way to force the iAd to refresh and request a new ad when the network is detected?
I just can’t find information on the behaviour of the Test Ads anywhere, and I can’t test with real Ads until I upload the app to the App Store (right?)
Heres my code:
Where the iAd is created:
- (void)viewDidLoad
{
adView = [[ADBannerView alloc] initWithFrame:CGRectMake(0, 410, 320, 50)];
adView.frame = CGRectOffset(adView.frame, 0, 50);
adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierPortrait];
adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
[self.view addSubview:adView];
adView.delegate=self;
self.bannerIsVisible=NO;
[super viewDidLoad];
}
And the delegate methods:
- (void)bannerViewDidLoadAd:(ADBannerView *)banner
{
NSLog(@"AdWin");
if (!self.bannerIsVisible)
{
[UIView beginAnimations:@"animateAdBannerOn" context:NULL];
banner.frame = CGRectOffset(banner.frame, 0, -50);
[UIView commitAnimations];
self.bannerIsVisible = YES;
}
}
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
NSLog(@"AdLose");
if (self.bannerIsVisible)
{
[UIView beginAnimations:@"animateAdBannerOff" context:NULL];
banner.frame = CGRectOffset(banner.frame, 0, 50);
[UIView commitAnimations];
self.bannerIsVisible = NO;
}
}
The delegate method NSLog calls only appear once – not every minute, like I would expect if the Ad was getting refreshed.
1- yes and like live ads there are some times with no ad at all, it can be hours. I believe the refresh cycle is 3 minutes but it seems apple can change it as they will
2- you shouldn’t need to, when properly setup this happens automatically. I have an app with ads and it behaves correctly when switching network or using the airplane setting
Now, there seems to be something about the airplane setting, see this thread : iAds Loading Throttled After Re-Launching App From Background (Also Happens In iAdSuite), but I don’t have the final answer. Maybe you could explore more by changing your NSLog in didFail… to NSLog(@”%@”, error) to check what it exactly says.
Ah and indeed there is no way to test with real ads until it’s accepted in the appstore.