0

I'm currently switching my application from AdWhirl to the mediation in admob. I have it working correctly everywhere except on the 4.3 simulator with the iPhone. It works fine with the 4.3 iPad and >=5 iPhone/iPad. (My 4.3 device met an unfortunate end so I can't test on that right now...)

On the iPhone AdMob ads will display fine, but when displaying iAds the device needs to be rotated before the ad will display. I don't have any idea what I'm doing wrong or if it's a bug in the framework.

I have a sample project here that demonstrates the issue.

Any ideas what's causing this?

Thanks for any help!

EDIT: I've tested on an actual device and it appears to be an issue there too.

Jonathon
  • 706
  • 6
  • 18

1 Answers1

0

It appears this is a bug in the framework. Here's the work around that I've come up with:

if ([self.controller.admobView.mediatedAdView isKindOfClass:[ADBannerView class]]) {
   if (![self.controller.admobView.mediatedAdView isDescendantOfView:self.controller.admobView]) {
      [self.controller.admobView addSubview:self.controller.admobView.mediatedAdView];
   }
   if (self.controller.admobView.mediatedAdView.frame.size.height == 0) {
      CGRect iadFrame;
      iadFrame.origin.x = iadFrame.origin.y = 0;
      iadFrame.size = [ADBannerView sizeFromBannerContentSizeIdentifier:((ADBannerView*)self.controller.admobView.mediatedAdView).currentContentSizeIdentifier];
      self.controller.admobView.mediatedAdView.frame = iadFrame;
   }
}

I haven't run into any issues with this yet, but time will tell if it causes any other issues... (Note that I'm comparing the height to zero and not checking for a zero rect because that comparison failed for some reason in my tests...)

(I've also made a post on the admob group, maybe someone there will know more...)

Jonathon
  • 706
  • 6
  • 18
  • Did you end up getting a chance to see if this issue also happens on device? I tried the code on a 4.3 iPhone and didn't see the issue, but did indeed see it in the simulator as you said. – RajPara Jul 16 '12 at 19:14
  • Well, this is weird. I don't have access to the iPhone 4 that was running 4.3.5 that I originally tested on but I have picked up an iPhone 3GS that's running 4.3.5 and it does NOT see the issue. But the iPhone 4 DID, but I wasn't able to test the stripped down version so it's possible that something else was causing the issue that I've since fixed. If I get a chance to test the simple version on the iPhone 4 I will, and see what happens... – Jonathon Jul 18 '12 at 22:25