ios - Shared iAd banner unloads ad after dismissing navigation popover -
i saw few other similar questions find answers... have shared iad banner. problem when load in modally presented navigationcontroller tableviewcontroller, when dismiss tableviewcontroller ad banner in mainviewcontroller loses ad , receive following error:
adbannerview: unhandled error (no delegate or delegate not implement didfailtoreceiveadwitherror:): error domain=aderrordomain code=7 "the operation couldn’t completed. ad unloaded banner" userinfo=0x5b60e283649 {adinternalerrorcode=7, nslocalizedfailurereason=ad unloaded banner, adinternalerrordomain=aderrordomain}
the view setup this: mainviewcontroller --> navigationcontroller --> tableviewcontroller
at point in app modally present viewcontroller shared ad , don't experience issue. (mainviewcontroller --> viewcontroller)
here code tableviewcontroller:
.h
#import <uikit/uikit.h> #import <iad/iad.h> #import "appdelegate.h" @interface tableviewcontroller : uitableviewcontroller <adbannerviewdelegate> @property (strong, nonatomic) iboutlet uitableview *table; @property (strong, nonatomic) adbannerview *adview; @end
.m
-(void) viewwillappear:(bool)animated { [super viewwillappear:yes]; // insert ad bar appdelegate *appdelegate = (appdelegate *)[[uiapplication sharedapplication ]delegate]; _adview = [appdelegate adview]; _adview.delegate = self; self.candisplaybannerads = true; if (ipad) { [_adview setframe:cgrectmake(0, self.view.frame.size.height - 65, 320, 65)]; } else { [_adview setframe:cgrectmake(0, self.view.frame.size.height - 50, 320, 50)]; } if (!_adview.bannerloaded) { [_adview setalpha:0]; } [self.view addsubview:_adview]; } - (void)bannerviewdidloadad:(adbannerview *)banner { [uiview beginanimations:nil context:null]; [uiview setanimationduration:1]; [banner setalpha:1]; [uiview commitanimations]; } - (void)bannerview:(adbannerview *)banner didfailtoreceiveadwitherror:(nserror *)error { [uiview beginanimations:nil context:null]; [uiview setanimationduration:1]; [banner setalpha:0]; [uiview commitanimations]; }
any tips appreciated. thanks
the problem because using:
self.candisplaybannerads = true;
as as:
if (ipad) { [_adview setframe:cgrectmake(0, self.view.frame.size.height - 65, 320, 65)]; } else { [_adview setframe:cgrectmake(0, self.view.frame.size.height - 50, 320, 50)]; } if (!_adview.bannerloaded) { [_adview setalpha:0]; } [self.view addsubview:_adview];
and created 2 instances of ad bar.
Comments
Post a Comment