简体   繁体   中英

AdMob test banner loads on simulator, Only real banner loads on device?

I can't get a test banner to load on a device. However, test banner loads on simulator no problem. I'm trying to test my AdMob/iAd singleton mediation. It works fine with test ads on simulator but AdMob never loads the test banner on actual device.

The following is the code to present AdMob banner:

    self.adBanner_=[[GADBannerView alloc]initWithFrame:CGRectMake(0, 0, 320, 50)]; 

    adBanner_.hidden=NO;

    adBanner_.delegate = self;   

    adBanner_.adUnitID = @"Unit-ID";

    GADRequest *request = [GADRequest request];

    [self.adBanner_ loadRequest:request];

    self.adBanner_.rootViewController = self;

    [self.view addSubview:self.adBanner_];   

    isLoaded_ = YES;   

    //  request.testDevices = @[ GAD_SIMULATOR_ID ]; <--loads test ad on simulator

    request.testDevices = @[ @"number" ];  <--supposed to load test ads on real device

Why aren't I receiving AdMob test ads on real device yet there's no problem with AdMob test ads on simulator? Is code wrong?

Just run your app on your test device. In the Debug Area AdMob will give you your test ID like so:

<Google> To get test ads on this device, call: request.testDevices = @[ @"testDeviceIDNumber" ]

After that just place your testDeviceIDNumber here:

GADRequest *request = [GADRequest request];
request.testDevices = @[ @"testDeviceNumberIDNumber"];
[self.adBanner_ loadRequest:request];

For keep testing on the simulator also, add @"Simulator" in this row:

request.testDevices = @[ @"testDeviceNumberIDNumber", @"Simulator"];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM