I've made a rectangle button, which, when the user taps it they go to their iPod.
I get this error once I press the button when debugging. I've checked thoroughly on the iPod code and everything seems to be correct.
Here is the error from the debugger called after throwing an instance of NSException
:
2011-04-23 18:42:11.580 iApp[1197:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSURL initFileURLWithPath:]: nil string parameter'
*** Call stack at first throw:
(
0 CoreFoundation 0x01369be9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0115e5c2 objc_exception_throw + 47
2 CoreFoundation 0x01322628 +[NSException raise:format:arguments:] + 136
3 CoreFoundation 0x0132259a +[NSException raise:format:] + 58
4 Foundation 0x00065b12 -[NSURL(NSURL) initFileURLWithPath:] + 90
5 iApp 0x000056f3 -[MainViewController setupApplicationAudio] + 148
6 iApp 0x00005af0 -[MainViewController viewDidLoad] + 78
7 UIKit 0x0037765e -[UIViewController view] + 179
8 UIKit 0x00379012 -[UIViewController viewControllerForRotation] + 63
9 UIKit 0x00374f76 -[UIViewController _visibleView] + 90
10 UIKit 0x0060ea97 -[UIClientRotationContext initWithClient:toOrientation:duration:andWindow:] + 354
11 UIKit 0x002f0ba8 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 954
12 UIKit 0x00570948 -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:] + 1053
13 UIKit 0x0037b982 -[UIViewController presentModalViewController:withTransition:] + 3151
14 iApp 0x00002330 -[MainerViewController goImport:] + 153
15 UIKit 0x002c9a6e -[UIApplication sendAction:to:from:forEvent:] + 119
16 UIKit 0x003581b5 -[UIControl sendAction:to:forEvent:] + 67
17 UIKit 0x0035a647 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
18 UIKit 0x003591f4 -[UIControl touchesEnded:withEvent:] + 458
19 UIKit 0x002ee0d1 -[UIWindow _sendTouchesForEvent:] + 567
20 UIKit 0x002cf37a -[UIApplication sendEvent:] + 447
21 UIKit 0x002d4732 _UIApplicationHandleEvent + 7576
22 GraphicsServices 0x01b80a36 PurpleEventCallback + 1550
23 CoreFoundation 0x0134b064 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
24 CoreFoundation 0x012ab6f7 __CFRunLoopDoSource1 + 215
25 CoreFoundation 0x012a8983 __CFRunLoopRun + 979
26 CoreFoundation 0x012a8240 CFRunLoopRunSpecific + 208
27 CoreFoundation 0x012a8161 CFRunLoopRunInMode + 97
28 GraphicsServices 0x01b7f268 GSEventRunModal + 217
29 GraphicsServices 0x01b7f32d GSEventRun + 115
30 UIKit 0x002d842e UIApplicationMain + 1160
31 iApp 0x00001b34 main + 102
32 iApp 0x00001ac5 start + 53
33 ??? 0x00000001 0x0 + 1
)
terminate
If you look at the very first line of your crash report, it states you are passing a nil string to NSURL's initFileURLWithPath method:
'NSInvalidArgumentException', reason: '*** -[NSURL initFileURLWithPath:]: nil string parameter'
From Apple documentation.
Passing nil for this parameter produces an exception.
So make sure to check your NSString before sending to initFileURLWithPath method,
NSURL* targetFileURL = nil ;
if(targetFilePath != nil)
{
targetFileURL = [[NSURL alloc] initFileURLWithPath:targetFilePath];
}
User contributions licensed under CC BY-SA 3.0