How to get kGADAdSizeSmartBannerPortrait to work

时间:2015-12-10 02:02:04

标签: ios iphone admob

I cannot get kGADAdSizeSmartBannerPortrait to work.

Expected: On iPhone 6 Plus, the width of a banner should be 414 points. On iPhone 6, the width of a banner should be 375 points. On other iPhones and iPods ad this point, the banner would be 320 points.

Actual outcome: I see the "320x50 Test Banner" on all devices. On wide devices, the 320x50 banner is centered in the view. The remaining space to the left and to the right has a grayish pattern.

Actual code used:

GADBannerView* newbanner = [[GADBannerView alloc] initWithAdSize:kGADAdSizeSmartBannerPortrait];
NSLog(@"newbanner size: %@", NSStringFromCGSize(newbanner.frame.size));
newbanner.adUnitID = @"/6499/example/banner";
newbanner.rootViewController = self;
GADRequest *request = [GADRequest request];
request.testDevices = @[
                        @"somedeviceid1",
                        @"somedeviceid2",
                        ];
[newbanner loadRequest:request];
[self.view addSubview:newbanner];
newbanner.center = CGPointMake(self.view.frame.size.width * 0.5, self.view.frame.size.height * 0.5);

iPhone 6 Plus screenshot:

iPhone 6 Plus screenshot of admob incorrectly sized smart banner ad.

1 个答案:

答案 0 :(得分:0)

kGADAdSizeSmartBannerPortrait仅适用于iOS(即使它并不完美)适用于我使用kGADAdSizeBanner的iOS,并且在为广告提供“广告素材”(又称图片)时在控制面板中确保还要添加2倍密度的广告视网膜版本。

enter image description here