2013-05-03 27 views
5

我在iOS应用上实施Admob。Admob测试设备未显示模拟器udid

我刚刚下载AdMob联播示例代码,当我试图在模拟器上运行它,我的控制台是说"To get test ads on this device, call: request.testDevices = NSArray arrayWithObjects:@"GAD_SIMULATOR_ID", nil];”。

所以,我说我的Mac UDID和测试设备UDID到一个数组并将其设置为请求。但是,应用程序仍然显示默认横幅,而不是我的admob帐户中的广告。此外,控制台也提供了同样的上述消息。有没有人知道我在这里丢失了什么?这里是代码。

self.adBanner = [[[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner 
               origin:origin]; 
self.adBanner.adUnitID = kSampleAdUnitID; 
self.adBanner.delegate = self; 
[self.adBanner setRootViewController:self]; 
[self.view addSubview:self.adBanner]; 
self.adBanner.center = CGPointMake(self.view.center.x, self.adBanner.center.y); 
GADRequest *request = [GADRequest request]; 
request.testing = YES; 
request.testDevices = [NSArray arrayWithObjects: @"XXXX-XXXX-XXXX-XXXX-XXXXXXXX", 
              @"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 
              nil]; 
[self.adBanner loadRequest:request]; 

顺便说一下,我将kSampleAdUnitID替换为我的Admob发布商ID和XXX,其中m y mac id和设备ID。

+0

https://developers.google.com/mobile-ads-sdk/docs/admob/intermediate – 2013-05-03 04:24:06

回答

0

其实,你并不需要添加testDevices能够获得的广告
我还没有收到广告,但是当我删除的testDevices我的DeviceID,它的工作原理
顺便说一句,如果你想添加模拟器ID只需使用@"GAD_SIMULATOR_ID",这是模拟器的默认ID,您只需要真实设备的真实ID。

8

启用测试广告

在您的iDevice,进入设置>隐私>广告和禁用“限制广告跟踪”选项。然后,当您在硬件上运行应用程序时,请检查Xcode的控制台:您将看到可以添加到testDevices数组的ID。

0

您需要的Devce Id是您手机的广告标识符的MD5散列。我下载了一个名为'标识符'link here的应用程序,它为您提供所有您需要的信息。

在createView方法中,将广告标识的MD5散列添加到testDevices数组中,然后您将在应用中看到添加。

var ad1 = Admob.createView({ 
      height: 50, 
      top: 0, 
      debugEnabled: true, // If enabled, a dummy value for `adUnitId` will be used to test 
      adType: Admob.AD_TYPE_BANNER, 
      adUnitId: 'ca-app-pub-000000xxxxxxxxxx/8204200000', // You can get your own at http: //www.admob.com/ 
      adBackgroundColor: 'black', 
      testDevices: [Admob.SIMULATOR_ID,'xxxc8xx0xxxccxxb4a12cxxxxxxxxxxx'], // You can get your device's id by looking in the console log 
       dateOfBirth: new Date(1985, 10, 1, 12, 1, 1), 
       gender: Admob.GENDER_MALE, // GENDER_MALE or GENDER_FEMALE default: undefined 
      contentURL: 'https://admob.com', // URL string for a webpage whose content matches the app content. 
      requestAgent: 'Titanium Mobile App', // String that identifies the ad request's origin. 
    extras: { 
     'version': 1.0, 
     'name': 'Eyespy' 
    }, // Object of additional infos 
    tagForChildDirectedTreatment: false, // http:///business.ftc.gov/privacy-and-security/childrens-privacy for more infos 
    keywords: ['keyword1', 'keyword2'] 
    }); 

    $.adview.add(ad1); 
相关问题