2010-07-29 178 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