使用admob時,在iPad landscape mode,當你看到 :
<Google> Invalid Request: {
"drt_include" = 1;
errors = "Ad size will not fit on screen";
"google.afma.Notify_dt" = 1367802121417;
"request_id" = 3;
"request_scenario" = "offline_empty";
type = admob;
"use_webview_loadurl" = 0;
}
這表示admob的ad錯了,仔細去看,會發現admob的bannerView height是0。
解法:
在.h內做個UIView wrapBannerView:
UIView *wrapBannerView;
在.m內把bannerView subview,並且其後以wrapBannerView運作,如下:
wrapBannerView = [[UIView alloc] initWithFrame:CGRectMake(2000, 2000, bannerView_.frame.size.width, bannerView_.frame.size.height) ];
[wrapBannerView addSubview:bannerView_];
....
[self.view addSubview:wrapBannerView];
....
wrapBannerView.center = newBannerCenter;
另外,不能將wrapBannerView加入view,原因在此。