0

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

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

4

1 回答 1

-1

你确定你已经释放了bannerView的Delegate吗?我创建了一个名为:“releaseBannerView”的方法。我这样做是为了“弱”链接我的 iAd.framework,并且只有在 iAd 类存在时才调用该方法。对于向后功能非常有效。

-(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:

- (void)dealloc {
 [super dealloc];
 [self releaseBannerView];
 ..and.others...
}
于 2010-08-08T03:49:09.600 回答