Can't click ad in iOS AdMob

95 views
Skip to first unread message

Spencer Uresk

unread,
Aug 4, 2014, 10:16:15 PM8/4/14
to google-adm...@googlegroups.com
I'm trying to show an ad below a tab bar controller. I have a controller that extends UITabBarController.

In the adViewDidReceiveAd callback, this is my code:


    if(isAdShown)

   {
       
return;

   }

   [UIView beginAnimations:@"BannerSlide" context:nil];

   self.adBanner.frame = CGRectMake(0.0, self.view.frame.size.height - self.adBanner.frame.size.height, self.adBanner.frame.size.width, self.adBanner.frame.size.height);

   self.view.frame = CGRectMake(0.0, 0.0, self.adBanner.frame.size.width, self.view.frame.size.height - self.adBanner.frame.size.height);

   [self.view addSubview:self.adBanner];

   [self.view bringSubviewToFront:self.adBanner];

   [UIView commitAnimations];


Here are the relevant parts of the view hierarchy (I've truncated some of the middle parts of it to make it more readable):

<UIWindow: 0x10c2772e0; frame = (0 0; 320 568); clipsToBounds = YES; opaque = NO; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x10c277bc0>; layer = <UIWindowLayer: 0x10c277610>>
   | <UILayoutContainerView: 0x10c17df90; frame = (0 0; 320 518); autoresize = W+H; animations = { position=<CABasicAnimation: 0x10c234830>; bounds=<CABasicAnimation: 0x10c2348d0>; }; layer = <CALayer: 0x10c1735d0>>
   |    | <UITransitionView: 0x10c17e7c0; frame = (0 0; 320 518); clipsToBounds = YES; autoresize = W+H; animations = { position=<CABasicAnimation: 0x10c234a20>; bounds=<CABasicAnimation: 0x10c234a80>; }; layer = <CALayer: 0x10c1740c0>>
   |    |    | <UIViewControllerWrapperView: 0x1116d1970; frame = (0 0; 320 518); autoresize = W+H; animations = { position=<CABasicAnimation: 0x10c2406e0>; bounds=<CABasicAnimation: 0x10c240780>; }; layer = <CALayer: 0x1116d1af0>>
   |    |    |    | 
   |    | <UITabBar: 0x10c261e70; frame = (0 469; 320 49); autoresize = W+TM; animations = { position=<CABasicAnimation: 0x10c2349b0>; }; layer = <CALayer: 0x10c221710>>
   |    |    | <_UITabBarBackgroundView: 0x1116d6cc0; frame = (0 0; 320 49); autoresize = W; userInteractionEnabled = NO; layer = <CALayer: 0x1116d5c10>>
   |    |    |    | <_UIBackdropView: 0x1116d7370; frame = (0 0; 320 49); opaque = NO; autoresize = W+H; userInteractionEnabled = NO; layer = <_UIBackdropViewLayer: 0x1116d76f0>>
   |    | <GADBannerView: 0x10c17f2c0; frame = (0 518; 320 50); clipsToBounds = YES; animations = { position=<CABasicAnimation: 0x10c2347a0>; }; layer = <CALayer: 0x10c17f4d0>>
   |    |    | <GADWebView: 0x1116bb9e0; baseClass = UIWebView; frame = (0 0; 320 50); clipsToBounds = YES; opaque = NO; autoresize = W+H; gestureRecognizers = <NSArray: 0x10c31b860>; layer = <CALayer: 0x1116bb320>>
   |    |    |    | <_UIWebViewScrollView: 0x1116bf590; frame = (0 0; 320 50); clipsToBounds = YES; autoresize = H; gestureRecognizers = <NSArray: 0x1116bf9a0>; layer = <CALayer: 0x1116bf460>; contentOffset: {0, 0}>
   |    |    |    |    | <UIWebBrowserView: 0x10d962a00; frame = (0 0; 320 50); opaque = NO; gestureRecognizers = <NSArray: 0x1116bdd80>; layer = <UIWebLayer: 0x1115da7d0>>
   |    |    |    |    |    | <TileHostLayer: 0x1116bc1a0> (layer)
   |    |    |    |    |    |    | <TileLayer: 0x10c320c50> (layer)
   |    |    |    |    | <UIImageView: 0x10c27dad0; frame = (0 46.5; 320 3.5); alpha = 0; opaque = NO; autoresize = TM; userInteractionEnabled = NO; animations = { position=<CABasicAnimation: 0x10c234500>; bounds=<CABasicAnimation: 0x10c2345a0>; }; layer = <CALayer: 0x10c274630>>
   |    |    |    |    | <UIImageView: 0x10c222980; frame = (316.5 0; 3.5 50); alpha = 0; opaque = NO; autoresize = LM; userInteractionEnabled = NO; animations = { position=<CABasicAnimation: 0x10c222c80>; bounds=<CABasicAnimation: 0x10c222d20>; }; layer = <CALayer: 0x10c222b10>>

The ad shows just fine, but nothing happens when you click on it. If I set clipsToBounds = YES on the parent view, the ad view just shows up as blank. Any thoughts on why it isn't showing up?

- Spencer

Eric Leichtenschlag

unread,
Aug 6, 2014, 5:12:44 PM8/6/14
to google-adm...@googlegroups.com
Hi Spencer,

The line:

self.adBanner.frame = CGRectMake(0.0, self.view.frame.size.height -self.adBanner.frame.size.height, self.adBanner.frame.size.width, self.adBanner.frame.size.height);

looks like you're changing the height of the adBanner. Doing so actually triggers another request since the ad size changes. This may be contributing to the problems you're seeing. Are you intentionally resizing the banner?

Thanks,
Eric

Reply all
Reply to author
Forward
0 new messages