我没有收到任何错误或其他信息。
我创建了一个CustomView文件,但是它似乎不起作用。
//CustomView.h
#import "GADBannerView.h"
@interface CustomView : UIView
{
GADBannerView *bannerView_;
}
第二档:
//CustomView.m
bannerView_ = [[GADBannerView alloc] initWithFrame:CGRectMake(0.0, 430, 320, 50)];
bannerView_.adUnitID = MY_BANNER_UNIT_ID;
bannerView_.rootViewController = [UIApplication sharedApplication].keyWindow.rootViewController;
NSLog(@"%@",bannerView_.rootViewController);
[self addSubview:bannerView_];
GADRequest *request = [GADRequest request];
request.testDevices = [NSArray arrayWithObjects: GAD_SIMULATOR_ID, nil];
[bannerView_ loadRequest:request];
最佳答案
根据文档,您应该像这样分配横幅:
[[GADBannerView alloc] initWithAdSize:kGADAdSizeSmartBannerPortrait];
当然,有了您需要的尺寸:)
关于ios - Admob无法加载广告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21632789/