AdMob测试横幅在模拟器上加载,只有真正的横幅加载在设备上?

时间:2015-02-05 19:50:48

标签: ios singleton admob

我无法在设备上加载测试横幅。但是,在模拟器上测试横幅加载没问题。我试图测试我的AdMob / iAd单身人士调解。它可以在模拟器上使用测试广告,但AdMob从不在实际设备上加载测试横幅。

以下是展示AdMob横幅的代码:

    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

为什么我没有在真实设备上接收AdMob测试广告,但在模拟器上AdMob测试广告没有问题?代码错了吗?

1 个答案:

答案 0 :(得分:1)

只需在测试设备上运行您的应用即可。在调试区域中,AdMob将为您提供如下测试ID:

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

之后只需将testDeviceIDNumber放在此处:

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

为了在模拟器上继续测试,请在此行中添加@“Simulator”:

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