Admob广告在ios Phonegap中无法点击

时间:2013-07-18 13:30:00

标签: iphone ios cordova admob

这是我的代码......

CGRect viewBounds = CGRectMake([[UIScreen mainScreen] applicationFrame].origin.x, 
[[UIScreen mainScreen] applicationFrame].origin.y, 
[[UIScreen mainScreen] applicationFrame].size.width, 
[[UIScreen mainScreen] applicationFrame].size.height-CGSizeFromGADAdSize(kGADAdSizeBanner).height);

 self.view.frame = viewBounds;

CGPoint origin = CGPointMake(0.0,theWebView.frame.size.height);

bannerView_ = [[[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner origin:origin] autorelease];


bannerView_.adUnitID = @"a151e39dc55f7f0";


bannerView_.rootViewController = self;

[self.view addSubview:bannerView_];

[self.view bringSubviewToFront:bannerView_];


GADRequest *request = [GADRequest request];

request.testDevices = [NSArray arrayWithObjects:
                       GAD_SIMULATOR_ID,                               // Simulator
                       @"heresthestringofmyphone",    // Test iPhone 3Gs 4.3.1
                       nil];

[bannerView_ loadRequest:request];

1 个答案:

答案 0 :(得分:0)

self.view.frame = viewBounds;

CGPoint origin = CGPointMake(0.0,theWebView.frame.size.height);

使用以下代码代替以上两行,它的工作就像一个魔术。

[super webView] .frame = viewBounds;

CGPoint origin = CGPointMake(0.0,[super webView] .frame.size.height);