簡體   English   中英

iPhone應用程序異常崩潰

[英]iPhone app crashes with exception

我有一個使用iAd的iPhone應用程序...該應用程序有時會崩潰並顯示以下消息;

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType bannerViewDidLoadAd:]: unrecognized selector sent to instance 0x621cd10'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x00e015a9 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x00f55313 objc_exception_throw + 44
    2   CoreFoundation                      0x00e030bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
    3   CoreFoundation                      0x00d72966 ___forwarding___ + 966
    4   CoreFoundation                      0x00d72522 _CF_forwarding_prep_0 + 50
    5   CoreFoundation                      0x00d71c7d __invoking___ + 29
    6   CoreFoundation                      0x00d71b51 -[NSInvocation invoke] + 145
    7   CoreFoundation                      0x00d72a04 ___forwarding___ + 1124
    8   CoreFoundation                      0x00d72522 _CF_forwarding_prep_0 + 50
    9   iAd                                 0x00[Switching to process 8860 thread 0x207]
0139f9 -[ADDistributedMessagingCenter messagePort:receivedMessage:withData:] + 251
    10  iAd                                 0x00014012 ADMessagePortCallBack + 75
    11  CoreFoundation                      0x00db8f4c __CFMessagePortPerform + 396
    12  CoreFoundation                      0x00de2944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
    13  CoreFoundation                      0x00d42cf7 __CFRunLoopDoSource1 + 215
    14  CoreFoundation                      0x00d3ff83 __CFRunLoopRun + 979
    15  CoreFoundation                      0x00d3f840 CFRunLoopRunSpecific + 208
    16  CoreFoundation                      0x00d3f761 CFRunLoopRunInMode + 97
    17  GraphicsServices                    0x033fe1c4 GSEventRunModal + 217
    18  GraphicsServices                    0x033fe289 GSEventRun + 115
    19  UIKit                               0x002ffc93 UIApplicationMain + 1160
    20  MyApp                     0x00001ba8 main + 102
    21  MyApp                     0x00001b39 start + 53
)
terminate called after throwing an instance of 'NSException'

以下是我的NSZombie消息;

#   Category    Event Type  RefCt   Timestamp   Address Size    Responsible Library Responsible Caller
77  DetailController    Zombie  -1  04:01.914.883   0x5768bd0   0   iAd -[ADDistributedMessagingCenter messagePort:receivedMessage:withData:]

還有bannerViewDidLoadAd代碼;

- (void)bannerViewDidLoadAd:(ADBannerView *)banner
{
    if (!bannerIsVisible)
    {
        [UIView beginAnimations:@"animateAdBannerOn" context:NULL];
        // assumes the banner view is offset -50 pixels so that it is not visible.
        banner.frame = CGRectOffset(banner.frame, 0, -50); // if the banner is on top of the screen use 50
        [UIView commitAnimations];
        bannerIsVisible = YES;
    }
}

請幫助我解決相同的問題。 謝謝。

基本上,您使用錯誤的對象類型來調用bannerViewDidLoadAd: 看來您正在使用某種調度機制來執行此操作。 在為該方法設置調度請求時,您指定了錯誤的對象,或者您未能保留該對象,並且該對象已被刪除並替換為NSType對象。

因此,請找到代碼中提到bannerViewDidLoadAd:位置,並確保與其一起使用的對象正確無誤並得到適當保留。

釋放委托后,bannerViewDidLoad被調用,因此出現了僵屍消息。

我猜這意味着您的廣告沒有發布,並且在您的控制器消失后仍會停留。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM