I'm getting a very strange crash due to iAd. Here's the debugger output:
2010-07-29 17:25:57.032 MemoryMatcherFree[5326:307] -[__NSOperationInternal bannerViewDidLoadAd:]: unrecognized selector sent to instance 0x13fda0
2010-07-29 17:25:57.051 MemoryMatcherFree[5326:307] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSOperationInternal bannerViewDidLoadAd:]: unrecognized selector sent to instance 0x13fda0'
*** Call stack at first throw:
(
0 CoreFoundation 0x3513cfd3 __exceptionPreprocess + 114
1 libobjc.A.dylib 0x303928a5 objc_exception_throw + 24
2 CoreFoundation 0x35140a77 -[NSObject(NSObject) doesNotRecognizeSelector:] + 102
3 CoreFoundation 0x3513ff15 ___forwarding___ + 508
4 CoreFoundation 0x350d2680 _CF_forwarding_prep_0 + 48
5 iAd 0x30fe70c7 -[ADBannerView transitionToNextBanner:] + 1230
6 iAd 0x30fe69b7 -[ADBannerView _adManagerLoadedBannerData:] + 314
7 iAd 0x30fddf13 -[ADCache _notifySuccess] + 358
8 iAd 开发者_Go百科 0x30fde25f -[ADCache _dispatchResponses] + 50
9 Foundation 0x339ccbd9 __NSFireTimer + 136
10 CoreFoundation 0x35112a5b __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 14
11 CoreFoundation 0x35114ee5 __CFRunLoopDoTimer + 860
12 CoreFoundation 0x35115865 __CFRunLoopRun + 1088
13 CoreFoundation 0x350be8eb CFRunLoopRunSpecific + 230
14 CoreFoundation 0x350be7f3 CFRunLoopRunInMode + 58
15 GraphicsServices 0x309776ef GSEventRunModal + 114
16 GraphicsServices 0x3097779b GSEventRun + 62
17 UIKit 0x321c12a7 -[UIApplication _run] + 402
18 UIKit 0x321bfe17 UIApplicationMain + 670
19 MemoryMatcherFree 0x00002b77 main + 70
20 MemoryMatcherFree 0x00002b2c start + 40
)
terminate called after throwing an instance of 'NSException'
Program received signal: “SIGABRT”.
Any ideas/things to try would be greatly appreciated. Cheers.
Are you sure that you have released the bannerView's Delegate? I created a method called: "releaseBannerView". I did it this way so that I could "weak" link my iAd.framework, and only call the method if the iAd class was present. Works really well for backwards capability.
-(void)releaseBannerView {
//Test for the ADBannerView Class, 4.0+ only (iAd.framework "weak" link Referenced)
Class iAdClassPresent = NSClassFromString(@"ADBannerView");
//If iOS has the ADBannerView class, then iAds = Okay:
if (iAdClassPresent != nil) {
//If instance of BannerView is Available:
if (self.bannerView) {
//Release the Delegate:
bannerView.delegate = nil;
//Release the bannerView:
self.bannerView = nil;
}
}
}
Then when needed and inside my Dealloc method, I can just nil out the bannerView by calling this method:
- (void)dealloc {
[super dealloc];
[self releaseBannerView];
..and.others...
}
精彩评论