1
votes

In my project I have a splitview and had previously implemented iAds using the splitview example from the Apple iAdSuite. Now I also wanted to implement Admob ads and since Adwhirl gave many errors in xcode 4.5 I tried using Admob Mediation (iOS SDK 6.2.0).

I got the ads to load and it properly mediates between iAd and Admob when necessary. However, one big problem remains. When I rotate the device (or simulator) before any ads have been loaded, I get the following crash:

Terminating app due to uncaught exception 'NSRangeException', reason: '* -[__NSArrayI objectAtIndex:]: index 0 beyond bounds for empty array'

* First throw call stack: (0x1b4e012 0x1701e7e 0x1b03b44 0x1c7ff 0x1c97b 0x1ba5b 0x1bff2 0x4581 0x699a0c 0x17156b0 0x701dfc0 0x701233c 0x701deaf 0x7386b4 0x6811a6 0x67fcbf 0x67fbd9 0x67ee34 0x67ec6e 0x67f435 0x67ef11 0x67eb2a 0x11c2dc9 0x1ba80c5 0x1b02efa 0x10f7482 0x8259be 0x6594d4 0x65a24b 0x64bcf8 0x1998df9 0x1998ad0 0x1ac3bf5 0x1ac3962 0x1af4bb6 0x1af3f44 0x1af3e1b 0x19977e3 0x1997668 0x64965c 0x203d 0x1f65)

libc++abi.dylib: terminate called throwing an exception

As a test I implemented Admob Mediation also in the iAdSuite splitview example ( can be found here) and see the same crash. Once an ad is loaded you can rotate all you want without any crashing. When I use Admob only (no mediation) I cannot make this crash happen.

It seems like it is crashing in the Admob code but there might be something else I'm not doing right to cause this. But at this point I'm stuck. Does anybody have an idea of how to make this crash go away?

Edit: I got the "Smart Banner Example 1.2" that Admob provides at http://code.google.com/p/google-mobile-dev/downloads/list. The only thing I 'changed' was to add the actual Admob SDK 6.2.0 files, the iAdAdapter, add the iAd framework and use a mediation ID. This also crashes on rotation when no ads are loaded yet.

I tried to post this issue on the Google AdMob Ads Developers forum but briefly something flashes up saying something like that the post needs to be approved. After two days nobody seems to have looked at the approval queue yet.

1

1 Answers

0
votes

Looks like this might be an issue with the AdMob SDK. I would probably workaround it by setting a boolean (i.e firstAdReceived) when you get an ad the first time, and then checking that before you change the adSize and other banner characteristics on orientation change.