ios - Admobs ad only shows on the simulator -
i've having issues creating admob ad shown on simulator , device. @ moment i't show on simulator. here ad say: publisher test ad.
i've searched sometime, cant find solution
why wont show on device well?
- (void)viewdidload { self.bannerview = [[gadbannerview alloc] initwithframe:cgrectmake(0.0, self.view.frame.size.height-50, gad_size_320x50.width, gad_size_320x50.height)]; self.bannerview.adunitid = myadunitid; self.bannerview.delegate = self; [self.bannerview setrootviewcontroller:self]; [self.view addsubview:self.bannerview]; [self.bannerview loadrequest:[self createrequest]]; [self.navigationcontroller.tabbarcontroller.tabbar sethidden:yes]; } -(gadrequest *)createrequest { gadrequest *request = [gadrequest request]; request.testdevices = [nsarray arraywithobjects:gad_simulator_id, nil]; return request; } -(void)adviewdidreceivead:(gadbannerview *)adview { nslog(@"ad received"); [uiview animatewithduration:1.0 animations:^{ adview.frame = cgrectmake(0.0, self.view.frame.size.height-50, adview.frame.size.width, adview.frame.size.height); }]; } -(void)adview:(gadbannerview *)view didfailtoreceiveadwitherror:(gadrequesterror *)error { nslog(@"error due to: %@", [error localizedfailurereason]); }
admobs ad shows on simulator
because added gad_simulator_id
in line of code showing testing ads on simulator.
[nsarray arraywithobjects:gad_simulator_id, nil];
so opinion can test on device if add device id
in array.so every time when open app show test add , possible if add available on google admob
show ad , start showing impression on admob
account.
Comments
Post a Comment