在更新xcode 4.4.1之后,我的应用不再通过编译过程。抛出此异常:

2012-09-11 14:32:19.057 MyApp[5001:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSURL initFileURLWithPath:]: nil string parameter'
*** First throw call stack:
(0x356d888f 0x37a7f259 0x356d8789 0x356d87ab 0x3516905f 0x35168ffb 0x4005 0x33144cab 0x3313e7dd 0x3310cac3 0x3310c567 0x3310bf3b 0x372cb22b 0x356ac523 0x356ac4c5 0x356ab313 0x3562e4a5 0x3562e36d 0x3313d86b 0x3313acd5 0x3d0d 0x3c70)
terminate called throwing an exception(lldb) bt
* thread #1: tid = 0x1c03, 0x35f8e32c libsystem_kernel.dylib`__pthread_kill + 8, stop reason = signal SIGABRT
    frame #0: 0x35f8e32c libsystem_kernel.dylib`__pthread_kill + 8
    frame #1: 0x32ada20e libsystem_c.dylib`pthread_kill + 54
    frame #2: 0x32ad329e libsystem_c.dylib`abort + 94
    frame #3: 0x35a90f6a libc++abi.dylib`abort_message + 46
    frame #4: 0x35a8e34c libc++abi.dylib`_ZL17default_terminatev + 24
    frame #5: 0x37a7f356 libobjc.A.dylib`_objc_terminate + 146
    frame #6: 0x35a8e3c4 libc++abi.dylib`_ZL19safe_handler_callerPFvvE + 76
    frame #7: 0x35a8e450 libc++abi.dylib`std::terminate() + 20
    frame #8: 0x35a8f824 libc++abi.dylib`__cxa_rethrow + 88
    frame #9: 0x37a7f2a8 libobjc.A.dylib`objc_exception_rethrow + 12
    frame #10: 0x3562e50c CoreFoundation`CFRunLoopRunSpecific + 404
    frame #11: 0x3562e36c CoreFoundation`CFRunLoopRunInMode + 104
    frame #12: 0x3313d86a UIKit`-[UIApplication _run] + 550
    frame #13: 0x3313acd4 UIKit`UIApplicationMain + 1080
    frame #14: 0x00003d0c MyApp`main + 152 at main.m:23

在这里我没有办法,因为在到达应用程序委托(delegate)之前会引发异常。所以我真的看不到我错过了网址...

如果有人可以提供帮助,那将真的很棒……谢谢:)

最佳答案

异常'NSInvalidArgumentException'的情况有两种,原因:'*-[NSURL initFileURLWithPath:]:nil string parameter':

1)将stringPath值传递给initFileURLWithPath:stringPath但为nil

2)initFileURLWithPath:stringPath除了要设置为 NSString的stringPath外,别无其他。

10-08 03:46