iPhone iAd -- not getting callbacks to didFailToReceiveAdWithError
I am testing an iAd app on an iPod touch. My iPod is connected to the internet. In all my testing, I have only received one callback to didFailToReceiveAdWithError.
Here is the relevant code:
#ifdef mAppHasAds
- (void)bannerViewDidLoadAd:(ADBannerView *)banner {
NSLog (@"Triangle ad");
bannerView.hidden = NO;
}
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error {
NSLog (@"No Triangle ad");
bannerView.hidden = YES;
}
#endif
And here are some of the NSLogs I am seeing. Note that some of the timestamps are 1 minute or 1 min 30 sec apart. To me, this indicates that ads failed to arrive. But there was no callback.
2010-07-25 20:11:36.403 UniversalTriangleSolver[10490:307] Triangle ad 2010-07-25 20:12:35.684 UniversalTriangleSolver[10490:307] Triangle ad 2010-07-25 20:13:05.684 UniversalTriangleSolver[10490:307] Triangle ad 2010-07-25 20:13:35.684 UniversalTriangleSo开发者_如何学Golver[10490:307] Triangle ad 2010-07-25 20:14:35.686 UniversalTriangleSolver[10490:307] Triangle ad 2010-07-25 20:16:05.689 UniversalTriangleSolver[10490:307] Triangle ad 2010-07-25 20:17:35.691 UniversalTriangleSolver[10490:307] Triangle ad 2010-07-25 20:19:05.693 UniversalTriangleSolver[10490:307] Triangle ad 2010-07-25 20:19:19.915 UniversalTriangleSolver[10490:307] ADManager: did enter background 2010-07-25 20:19:19.940 UniversalTriangleSolver[10490:307] ADManager: will terminate
I see it differently -- If your app failed to receive an ad, it would log "No Triangle Ad" -- but it never does.
I think your code "bannerView.hidden = NO" isn't pushing the view to the display.
Want to try this instead?
- (void)bannerViewDidLoadAd:(ADBannerView *)banner
{
if (!self.bannerIsVisible)
{
[UIView beginAnimations:@"animateAdBannerOn" context:NULL];
// banner is invisible now and moved out of the screen on 50 px
banner.frame = CGRectOffset(banner.frame, 0, 50);
[UIView commitAnimations];
self.bannerIsVisible = YES;
}
}
精彩评论