2010-07-29 101 views
0

由于iAd我得到了一个非常奇怪的崩溃。这里是调试器输出:奇怪的iAd错误导致崩溃

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         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”. 

任何想法/事情尝试将不胜感激。干杯。

回答

-1

你确定你已经发布bannerView的委托吗?我创建了一个名为“releaseBannerView”的方法。我这样做,以便我可以“弱”链接我的iAd.framework,并且只有在iAd类出现时才调用方法。对于向后的功能非常有效。

- (void)dealloc { 
[super dealloc]; 
[self releaseBannerView]; 
..and.others... 
} 

需要时
-(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; 
     } 
    } 
} 

然后和我的dealloc方法里面,我可以仅仅通过调用此方法无出bannerView