3

i am loading banner ads at the bottom of the view controllers they load the add message connected to iAd network

but getting error messages at the bottom of the xcode screen

2014-07-20 11:21:38.515 WeddingsAndMore[30983:60b] Reachability Flag Status: -R ------- networkStatusForFlags
2014-07-20 11:21:38.768 WeddingsAndMore[30983:60b] Error receive ad: Error Domain=ADErrorDomain Code=7 "The operation couldn’t be completed. Ad was unloaded from this banner" UserInfo=0x10db25db0 {ADInternalErrorCode=7, NSLocalizedFailureReason=Ad was unloaded from this banner, ADInternalErrorDomain=ADErrorDomain}
2014-07-20 11:21:38.971 WeddingsAndMore[30983:60b] [AppDeveloper] ADBannerView: Unhandled error (no delegate or delegate does not implement didFailToReceiveAdWithError:): Error Domain=ADErrorDomain Code=3 "The operation couldn’t be completed. Ad inventory unavailable" UserInfo=0x10d87e570 {ADInternalErrorCode=3, NSLocalizedFailureReason=Ad inventory unavailable, ADInternalErrorDomain=ADErrorDomain}
2014-07-20 11:21:39.972 WeddingsAndMore[30983:60b] [AppDeveloper] ADBannerView: Unhandled error (no delegate or delegate does not implement didFailToReceiveAdWithError:): Error Domain=ADErrorDomain Code=5 "The operation couldn’t be completed. Banner view is visible but does not have content" UserInfo=0x10d9272b0 {ADInternalErrorCode=5, NSLocalizedFailureReason=Banner view is visible but does not have content, ADInternalErrorDomain=ADErrorDomain}

and the longer i keep it open in the simulator the more i get

code as follows

.h file

#import <UIKit/UIKit.h>
#import <iAd/iAd.h>

@interface DMKPickViewController : UIViewController <ADBannerViewDelegate>
@property (strong, nonatomic) IBOutlet ADBannerView *bannerView;

@end

.m file

#import "DMKPickViewController.h"

#import "DMKAppDelegate.h"

@interface DMKPickViewController ()

@end

@implementation DMKPickViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}







- (void)viewDidLoad
{

    _bannerView = [[ADBannerView alloc] initWithFrame:CGRectZero];
    _bannerView.delegate = self;
    _bannerView.hidden = NO;

    [self.view addSubview:_bannerView];
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}
- (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
{

}






- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (void)viewDidAppear:(BOOL)animated
{

}

this is the first time i have implemented iAd so im new to this

rmaddy
  • 314,917
  • 42
  • 532
  • 579
  • This might help you http://stackoverflow.com/questions/18914553/iad-banner-does-not-appear-but-the-code-and-right-i-can-not-find-a-solution – codester Jul 20 '14 at 10:38
  • ?? are u saying its an ios7 bug or i need to make those changes? i have made the changes and still getting the errors – Mike J Aspinall Jul 20 '14 at 10:52
  • No there may be problem of proxy settings or network issue.It may happen that iAd is not able to fill properly banner. – codester Jul 20 '14 at 11:01
  • As in question Edit : "HI all finally i solved problem my self none of the blog didnt give any solution.I am not getting Test ad in the simulator it is coming in the device only by changing of the internal proxy settings.Its good experience for me and also my suggestion is while your operating with IOS device make sure to take proxy free device so that at least you can eliminate some of the issue related to proxy, dont forget to work proxy related stuff at the end product:)" Check your proxy settings – codester Jul 20 '14 at 11:16

1 Answers1

0

If you're moving to a screen where the ad can't be seen, you are recommended to disable the ad. Then you shouldn't have any possibility to fail to receive it. Remove it from the superview, set the delegate to nil, and release it. Create it again when it will be visible again.

Patel Jigar
  • 2,141
  • 1
  • 23
  • 30