1

I have a UISplitViewController and I have the MasterViewController with a UITableViewController. I want to add an iAd at the bottom of the view. I think I have achieved this, but there are no ad's showing.

self.adBannerView = [[ADBannerView alloc] initWithFrame:CGRectZero];
self.adBannerView.frame = CGRectMake(0, self.view.frame.size.height - 50, 320, 50);
[self.view addSubview:self.adBannerView];

//set proper bottom inset depending on your banner height
self.tableView.contentInset = UIEdgeInsetsMake(0, 0, 50, 0);

adBannerView.delegate = self;

I have implemented the delegate methods:

- (void)bannerViewDidLoadAd:(ADBannerView *)banner
{
    if (!_bannerIsVisible)
    {
        // If banner isn't part of view hierarchy, add it
        if (adBannerView.superview == nil)
        {
            [self.view addSubview:adBannerView];
        }

        [UIView beginAnimations:@"animateAdBannerOn" context:NULL];

        // Assumes the banner view is just off the bottom of the screen.
        // banner.frame = CGRectOffset(banner.frame, 0, -banner.frame.size.height);

        [UIView commitAnimations];

        _bannerIsVisible = YES;
    }
}

- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
    NSLog(@"Failed to retrieve ad MLEFT");
    NSLog(@"MLEFT Error :%@",error);
    if (_bannerIsVisible)
    {
        [UIView beginAnimations:@"animateAdBannerOff" context:NULL];

        // Assumes the banner view is placed at the bottom of the screen.
        // banner.frame = CGRectOffset(banner.frame, 0, banner.frame.size.height);

        [UIView commitAnimations];

        _bannerIsVisible = NO;
    }

}

But the ad is not showing. Also not after a few hours waiting. In another view, the ad is loaded.

What am I missing here?

1 Answer 1

0
  1. Make sure you have added iAd.framework in **Build Phases => Link Binary With Libraries.
  2. In case you are using storyboard, check if ADBannerView is not behind any other view. (I suggest try to put at 0,0 position in front of all views for testing)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.