0

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
{

}
09apps
  • 13
  • 4
  • testing on iOS and simulator. When tried running on device, I mostly get errors Error receive ad: Error Domain=ADErrorDomain Code=0 "The operation couldn’t be completed. Unknown error" UserInfo=0x1e58c950 {ADInternalErrorCode=0, ADInternalErrorDomain=ADErrorDomain, NSLocalizedFailureReason=Unknown error} OR Error receive ad: Error Domain=ADErrorDomain Code=3 "The operation couldn’t be completed. Ad inventory unavailable" UserInfo=0x1ed7ec90 {ADInternalErrorCode=3, ADInternalErrorDomain=ADErrorDomain, NSLocalizedFailureReason=Ad inventory unavailable} – 09apps Aug 29 '13 at 18:27

2 Answers2

0

What about giving a size to your bannerView ?

From your code:

_bannerView = [[ADBannerView alloc] initWithFrame:CGRectZero];

Width = 0, Height = 0

And here you just update the position:

CGRect bannerFrame = CGRectMake(0.0, (self.view.frame.size.height - 50), 0.0, 0.0);

Width = 0, Height = 0

Cyril
  • 1,649
  • 1
  • 17
  • 32
  • It is still the same. No errors, log messages nothing. When I comment _bannerView.hidden = YES; I can see the empty frame. testing on iOS 6.1 simulator – 09apps Aug 30 '13 at 06:41
  • Just tried your code in a test project (with changes on the frame), it works. Did you try to remove your app from your simulator/device, then do a clean (shift + cmd + K) and try again. – Cyril Aug 30 '13 at 08:02
  • Hi Cyril, Thanks! I still could not see it, so I am now using AdMob with mediation – 09apps Sep 03 '13 at 04:34
0

I had the same problem. I ended up going to iTunes Connect, and clicked on the iAd section. Then I agreed to some contract and went to the iAd Workbench area. There, I didn't bother doing anymore because I'm not at the point where I want to advertise the game I'm developing yet.

I didn't change any code, but my iOS game was still running. To my surprise, the ads started to show up right after I agreed to the iAd agreement in iTunes Connect!

Gary Shaw
  • 51
  • 2