【发布时间】:2015-02-07 02:00:25
【问题描述】:
我使用的是 GoogleMobileAdsSDKiOS 7.0.0。我按照 Google 的 AdMob 说明设置 AdMob,然后按照中介说明进行操作。使用 iAd/AdMob 进行中介在模拟器上运行良好,但在设备上却无法运行。 iAd 几乎从不失败,并且当它失败时,AdMob 测试横幅永远不会加载。
- (void)viewDidLoad
{
[super viewDidLoad];
self.adView = [[ADBannerView alloc] initWithFrame:CGRectMake(0, 60, 320, 50)];
self.adView.delegate = self;
[self.view addSubview:adView];
}
-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error{
self.adView.hidden=YES;
NSLog(@"Google Mobile Ads SDK version: %@7.0.0", [GADRequest sdkVersion]);
self.adBanner_=[[GADBannerView alloc]initWithFrame:CGRectMake(0, 0, 320, 50)];
self.adBanner_.adUnitID = @"my-ID";
self.adBanner_.rootViewController=self;
[self.view addSubview:self.adBanner_];
GADRequest *request =[GADRequest request];
request.testDevices = @[ @"2077ef9a63d2b398840261c8221a0c9b"];
[self.adBanner_ loadRequest:request];
}
我还尝试使用 bannerViewDidLoadAd 来显示 adView 已加载,但只会同时加载 AdMob 和 iAd,因此我无法使用 bannerViewDidLoadAd。
我不明白为什么 AdMob/iAd 不能在设备上进行调解,但在模拟器上却可以正常工作。不明白为什么 AdMob 从来没有在设备上加载测试横幅。
【问题讨论】:
-
对于 AdMob,让您正确获取设备 ID。
-
如果你只实现admob,它会显示在设备上吗?
-
只有调解问题。如果我添加上面的 adBanner 代码,它会显示在 ViewDidLoad 中。但随后它与 iAd 同时出现。显然,这不是我想要的调解。