簡體   English   中英

由於未捕獲的異常“ NSInvalidArgumentException”而終止應用程序

[英]Terminating app due to uncaught exception 'NSInvalidArgumentException'

我正在使用ShareKit允許用戶在我的iPhone應用程序中在Twitter和Facebook上分享他們的分數。 但是,在共享這兩種服務后不久,它似乎崩潰了。 我收到一條控制台消息,內容為:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFString rangeOfString:options:range:locale:]: nil argument'
*** Call stack at first throw:
(
 0   CoreFoundation                      0x026d6919 __exceptionPreprocess + 185
 1   libobjc.A.dylib                     0x028245de objc_exception_throw + 47
 2   CoreFoundation                      0x0268f078 +[NSException raise:format:arguments:] + 136
 3   CoreFoundation                      0x0268efea +[NSException raise:format:] + 58
 4   Foundation                          0x0008f97b -[NSString rangeOfString:options:range:locale:] + 424
 5   Foundation                          0x0009de16 -[NSString rangeOfString:] + 104
 6   iPhone Typer                        0x00030220 -[SHKOAuthView webView:shouldStartLoadWithRequest:navigationType:] + 151
 7   UIKit                               0x004bb456 -[UIWebView webView:decidePolicyForNavigationAction:request:frame:decisionListener:] + 458
 8   CoreFoundation                      0x0264742d __invoking___ + 29
 9   CoreFoundation                      0x02647301 -[NSInvocation invoke] + 145
 10  WebCore                             0x030940f0 _ZL20HandleDelegateSourcePv + 64
 11  CoreFoundation                      0x026b7d7f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
 12  CoreFoundation                      0x026162cb __CFRunLoopDoSources0 + 571
 13  CoreFoundation                      0x026157c6 __CFRunLoopRun + 470
 14  CoreFoundation                      0x02615280 CFRunLoopRunSpecific + 208
 15  CoreFoundation                      0x026151a1 CFRunLoopRunInMode + 97
 16  GraphicsServices                    0x02e5e2c8 GSEventRunModal + 217
 17  GraphicsServices                    0x02e5e38d GSEventRun + 115
 18  UIKit                               0x00339b58 UIApplicationMain + 1160
 19  iPhone Typer                        0x00002894 main + 102
 20  iPhone Typer                        0x00002825 start + 53
)
terminate called after throwing an instance of 'NSException'

我該如何解決? 謝謝。

在objc_exception_throw上設置一個斷點,然后構建用於調試的應用程序,運行具有斷點的應用程序,並再次導致崩潰,然后將堆棧移至相關代碼。

SHKOAuthView內部的某些內容webView:shouldStartLoadWithRequest:navigationType:正在將nil參數傳遞給NSString rangeOfString。 當您知道傳遞nil的內容時,問題可能很明顯-未能通過相關代碼和您確定的任何其他信息來更新您的問題。

暫無
暫無

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

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