I'm use the following code to add banner:
- (void) addBunner {
CGRect frame = CGRectMake(0.0,
self.view.frame.size.height-50.0,
320.0,
50.0);
UIWindow* window = [UIApplication sharedApplication].keyWindow;
if (!window) {
window = [[UIApplication sharedApplication].windows objectAtIndex:0];
}
ADBannerView *adView = [[ADBannerView alloc] initWithFrame:frame];
adView.delegate=self;
[window addSubview:adView];
}
- (void)viewDidLoad
{
[super viewDidLoad];
[self addBunner];
}
iAd.framework is added.
App is crashing without any messages in log. Where is a problem?
The app is crashing because you are adding banner in window.
REASON : ADBannerView must be part of a view hierarchy managed by a UIViewController.
So add banner in UIViewController.