I have gone through many tutorials and believe have done everything, but still can not figure it out, the bannerview does not show ad anytime, I have even put log messages in bannerViewDidLoadAd, didFailToReceiveAdWithError , but those do not get displayed also. Here is the code
I have registered my account in iTunesConnect under monetize, but tax information is pending.Also my app runs only in potrait mode, so no need to handle landscape.
In .h file :
#import <UIKit/UIKit.h>
#import <iAd/iAd.h>
@interface MBViewController : UIViewController <ADBannerViewDelegate>
@property (strong, nonatomic) ADBannerView *bannerView;
@end
In .m file :
- (void)viewDidLoad
{
[super viewDidLoad];
_bannerView = [[ADBannerView alloc] initWithFrame:CGRectZero];
_bannerView.delegate = self;
_bannerView.hidden = YES;
[self.view addSubview:_bannerView];
}
- (void)bannerViewDidLoadAd:(ADBannerView *)banner
{
NSLog(@"bannerViewDidLoadAd");
CGRect bannerFrame = CGRectMake(0.0, (self.view.frame.size.height - 50), 0.0, 0.0);
[self.bannerView setFrame:bannerFrame];
self.bannerView.hidden = NO;
}
-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
NSLog(@"Error receive ad: %@", error);
self.bannerView.hidden = YES;
}
- (BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner
willLeaveApplication:(BOOL)willLeave
{
return YES;
}
- (void)bannerViewActionDidFinish:(ADBannerView *)banner
{
}
What about giving a size to your bannerView ?
From your code:
Width = 0, Height = 0
And here you just update the position:
Width = 0, Height = 0