我的应用在设备中运行时没有任何错误。但是在模拟器中运行时会发生很多链接错误。
以下是Google添加视图(横幅视图)的代码
-(void)loadAddMobConfigs{
switch ([UIDevice currentDevice].userInterfaceIdiom) {
case UIUserInterfaceIdiomPhone:
self.bannerSizes = @[ @"Large Banner", @"Banner", @"Smart Banner" ];
break;
case UIUserInterfaceIdiomPad:
self.bannerSizes = @[
@"Large Banner", @"Banner", @"Smart Banner",
@"Full Banner",
@"Medium Rectangle",
@"Leaderboard"
];
break;
case UIUserInterfaceIdiomUnspecified:
self.bannerSizes = @[ @"Large Banner", @"Banner", @"Smart Banner" ];
break;
default:
break;
}
self.ads = @{
@"Banner" : NSValueFromGADAdSize(kGADAdSizeBanner),
@"Large Banner" : NSValueFromGADAdSize(kGADAdSizeLargeBanner),
@"Smart Banner Portrait" : NSValueFromGADAdSize(kGADAdSizeSmartBannerPortrait),
@"Smart Banner Landscape" : NSValueFromGADAdSize(kGADAdSizeSmartBannerLandscape),
@"Full Banner" : NSValueFromGADAdSize(kGADAdSizeFullBanner),
@"Medium Rectangle" : NSValueFromGADAdSize(kGADAdSizeMediumRectangle),
@"Leaderboard" : NSValueFromGADAdSize(kGADAdSizeLeaderboard)
};
if (!self.bannerView)
{
self.bannerView = [[GADBannerView alloc] init];
self.bannerView.adUnitID = @"xxxxxxxxxxxxxxxxxx";
self.bannerView.rootViewController = self;
self.bannerView.delegate = self;
[self.view addSubview:self.bannerView];
}
}
使用横幅广告