Admob not showing in webViewDidFinishLoad when using iframe

215 views Asked by At

I am creating an app using Phonegap and Onsen UI. I am able to show the Admob ads using this code:

- (void)webViewDidFinishLoad:(UIWebView*)theWebView
{
    // Black base color for background matches the native apps
    theWebView.backgroundColor = [UIColor blackColor];

    CGPoint origin = CGPointMake(0.0,
                                 self.view.frame.size.height -
                                 CGSizeFromGADAdSize(kGADAdSizeBanner).height);
    bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner
                                                 origin:origin];

    bannerView_.center = CGPointMake(self.view.center.x, self.view.frame.size.height-CGSizeFromGADAdSize(kGADAdSizeBanner).height/2);


    bannerView_.adUnitID = @"myid";
    bannerView_.rootViewController = self;
    [self.view addSubview:bannerView_];
    [bannerView_ loadRequest:[GADRequest request]];

    return [super webViewDidFinishLoad:theWebView];
}

However, if I use iframe, the ads will not showing. Why this happened and how to solve it?

0

There are 0 answers