views:

84

answers:

1

Hello,

I am using ShareKit to allow the user to share their score on Twitter and Facebook in my iPhone app. However, it seems to crash shortly after sharing on either service. I get an console message which says:

*** 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'

How would I fix this? Thanks.

A: 

Set a breakpoint on objc_exception_throw, then build the app for debug, run the app with breakpoints on and cause the crash again, then go up the stack to the relevant code.

Something inside SHKOAuthView webView:shouldStartLoadWithRequest:navigationType: is passing a nil argument to NSString rangeOfString. When you know what is passing the nil, it may be obvious what the problem is - failing that update your question with the relevant code and any extra information you've determined.

JosephH