So I followed some tutorials on how to integrate iAds, and finally managed to get it to work, but only visually that is. What I mean is that I see the ad on my iPhone app, I can click on it and see the test info, but none of the events were ever fired. Below is my code for the event handlers, is there anything I should check out?
- (void)bannerViewDidLoadAd:(ADBannerView *)banner
{
NSLog(@"--- bannerViewDidLoadAd ---");
NSLog(@"self.isBannerVisible: %@", self.isBannerVisible);
if(!self.isBannerVisible)
{
[UIView beginAnimations:@"animatedAdBannerOn" context:NULL];
self.banner.frame = CGRectOffset(self.banner.frame, 0.0, self.bannerVisibleY);
self.header.frame = CGRectOffset(self.header.frame, 0.0, self.headerWithBannerY);
[UIView commitAnimations];
self.isBannerVisible = YES;
}
}
- (void)bannerView:(ADBannerView *)banner
didFailToReceiveAdWithError:(NSError *)error
{
NSLog(@"--- bannerView ---");
NSLog(@"error: %@", error);
NSLog(@"self.isBannerVisible: %@", self.isBannerVisible);
if(self.isBannerVisible)
{
[UIView beginAnimations:@"animatedAdBannerOff" context:NULL];
self.banner.frame = CGRectOffset(self.banner.frame, 0.0, self.bannerHiddenY);
self.header.frame = CGRectOffset(self.header.frame, 0.0, self.headerNoBannerY);
[UIView commitAnimations];
self.isBannerVisible = NO;
}
}
Putting in the header only declares that this ViewController conforms to the ADBannerViewDelegate protocol. You still need to actually set the delegate property of the ADBannerView. If you are using a .nib, control drag from the banner to File’s Owner and select delegate.
Generally if you’re delegate callbacks aren’t getting called, this is the problem.