user532445
user532445

Reputation: 763

Problem with iAd implementation?

I am able to see iAd in simulator but It's not appearing in Device it throwing run time error...

bannerView:didFailToReceiveAdWithError: The operation couldn’t be completed. Ad inventory unavailable

how to resolve this error.??? Help me out..Thank you.

One more interesting thing I have implemented iAd feature and when I am running my iPhone application on Device It's throwing error and as a result It's not showing iAd but when same application I am running in iPad It's running fine It's amazing for me can any one tell me why it happened?

Thank you.

Upvotes: 0

Views: 489

Answers (2)

Vincent
Vincent

Reputation: 4409

Most often this message occurs when the iAd view in the storyboard is not linked to the IBOutlet in your .h file.

Upvotes: 0

Mark Chackerian
Mark Chackerian

Reputation: 23512

There are number of threads on Stack Overflow that say that there isn't enough ad inventory to go around. In other words, even though you are asking for an ad, Apple doesn't have one to give you. It's possible that there is a higher inventory for iPad ads available right now, because there are fewer iPad apps out there.

As for dealing with the error, make sure that your ViewController is implementing ADBannerViewDelegate and then put in the Apple recommended code to hide the ad when there is no ad, i.e. something like

#pragma mark -
#pragma mark ADBannerViewDelegate interface
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError
*)error{
    NSLog(@"%@",[error localizedDescription]);
    [banner setHidden:YES];
 }

// Handle ad loading // usualy set to show up in the view
- (void)bannerViewDidLoadAd:(ADBannerView
*)banner{    
    [banner setHidden:NO];
    NSLog(@"Ad visible");

}

Upvotes: 1

Related Questions