Ive read almost everything Ive found on the subject on this forum and elsewhere, but I still cant get "didFailToReceiveAdWithError" to execute, and thus an empty iAd-banner is still displayed even when the wifi is turned off.
To keep the sample simple Ive included only what is relevant to the iAd-code.
Ive imported the iAd-framwork to my project, and the code runs the first piece of code (inside "viewWillAppear") successfully. But never will the add disappear (when turning off the wifi), and never will the log even show didFailToReceiveAdWithError.
MyViewController.h
MyViewController.m
Am I wrong in thinking that the error should execute when the wifi is turned off? Otherwise, what could be the problem?
To keep the sample simple Ive included only what is relevant to the iAd-code.
Ive imported the iAd-framwork to my project, and the code runs the first piece of code (inside "viewWillAppear") successfully. But never will the add disappear (when turning off the wifi), and never will the log even show didFailToReceiveAdWithError.
MyViewController.h
Code:
#import <iAd/ADBannerView.h>
#import <iAd/iAd.h>
@interface MyViewController : UIViewController <ADBannerViewDelegate>
{
ADBannerView *adView;
BOOL bannerIsVisible;
}
@property (nonatomic, assign) BOOL bannerIsVisible;
MyViewController.m
Code:
#import "MyViewController.h"
@implementation MyViewController
@synthesize bannerIsVisible;
- (void)viewWillAppear:(BOOL)animated
{
if (!bannerIsVisible){
NSLog(@"Show iAd");
adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
adView.frame = CGRectOffset(adView.frame, 0, 367);
adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier320x50;
[self.view addSubview:adView];
adView.delegate=self;
bannerIsVisible = YES;
}
}
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
NSLog(@"didFailToReceiveAdWithError");
if (bannerIsVisible){
[UIView beginAnimations:@"animateAdBannerOff" context:NULL];
adView.frame = CGRectOffset(adView.frame, 0, +50);
[UIView commitAnimations];
bannerIsVisible = NO;
}
}
Am I wrong in thinking that the error should execute when the wifi is turned off? Otherwise, what could be the problem?