Trying to implement iAd in a Universal App with a number of different view controllers, have tried implementing the sample code from Apple's iAd suite, both the basic in an individual viewcontroller and seperately using the navigationcontroller code, both result in a crash that refers to pngData added to a dictionary when nil. There is no Dictionary in the viewcontroller nor is there anything named pngData. This is the stacktrace-
2012-03-14 15:24:24.389 TheApp[11372:207] CRASH: -[__NSCFDictionary setObject:forKey:]: attempt to insert nil value (key: pngData)
2012-03-14 15:24:24.390 TheApp[11372:207] Stack Trace: (
0 CoreFoundation 0x0328f5a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x030be313 objc_exception_throw + 44
2 CoreFoundation 0x03247ef8 +[NSException raise:format:arguments:] + 136
3 CoreFoundation 0x03247e6a +[NSException raise:format:] + 58
4 CoreFoundation 0x0328de15 -[__NSCFDictionary setObject:forKey:] + 293
5 iAd 0x001a0cd8 -[ADBannerController executeBannerViewActionFrom:withClickLocation:] + 422
6 iAd 0x001914d8 -[ADBannerView touchesEnded:withEvent:] + 355
7 UIKit 0x00497ded -[UIWindow _sendTouchesForEvent:] + 567
8 UIKit 0x00478c37 -[UIApplication sendEvent:] + 447
9 UIKit 0x0047df2e _UIApplicationHandleEvent + 7576
10 GraphicsServices 0x03828992 PurpleEventCallback + 1550
11 CoreFoundation 0x03270944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
12 CoreFoundation 0x031d0cf7 __CFRunLoopDoSource1 + 215
13 CoreFoundation 0x031cdf83 __CFRunLoopRun + 979
14 CoreFoundation 0x031cd840 CFRunLoopRunSpecific + 208
15 CoreFoundation 0x031cd761 CFRunLoopRunInMode + 97
16 GraphicsServices 0x038271c4 GSEventRunModal + 217
17 GraphicsServices 0x03827289 GSEventRun + 115
18 UIKit 0x00481c93 UIApplicationMain + 1160
19 TheApp 0x00002039 main + 169
20 TheApp 0x00001f85 start + 53
21 ??? 0x00000001 0x0 + 1
)
and just before the crash, which happens when I click on the banner i get a bunch of errors, more than 50 all to do with CGContext and all pretty similar to this
<Error>:CGContextRestoreGState: invalid context 0x0
<Error>: CGContextSetBaseCTM: invalid context 0x0
<Error>: CGContextRestoreGState: invalid context 0x0
<Error>: CGContextRestoreGState: invalid context 0x0
<Error>: CGContextSetBaseCTM: invalid context 0x0
I put a breakpoint all exceptions and it stops at-
int retVal = UIApplicationMain(argc, argv, nil, NSStringFromClass([TheAppAppDelegate class]));
I have searched high and low and can't find an answer to this one, one last thing, it works fine in the iOS 5.0 simulator but crashes in the iOS4.3 Simulator
User contributions licensed under CC BY-SA 3.0