2016-09-21 15:27:09.838 HandShaker[10945:178953] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString replaceOccurrencesOfString:withString:options:range:]: nil argument'
*** First throw call stack:
(
0 CoreFoundation 0x00007fffa118b4f2 __exceptionPreprocess + 178
1 libobjc.A.dylib 0x00007fff9d0b273c objc_exception_throw + 48
2 CoreFoundation 0x00007fffa11f24bd +[NSException raise:format:] + 205
3 CoreFoundation 0x00007fffa10d8f5c -[__NSCFString replaceOccurrencesOfString:withString:options:range:] + 156
4 Foundation 0x00007fff9790ad35 -[NSString stringByReplacingOccurrencesOfString:withString:options:range:] + 184
5 Foundation 0x00007fff9790ac6e -[NSString stringByReplacingOccurrencesOfString:withString:] + 92
6 HandShaker 0x0000000100037f40 -[SFViewModel setSffile:] + 2080
7 HandShaker 0x0000000100037370 -[SFViewModel initWithSFFile:withClient:] + 768
8 HandShaker 0x000000010017d3e1 -[SFPhotoAlbumsViewModel parserPhotoLibraryData:] + 1297
9 HandShaker 0x0000000100071eec __53-[SFPhotoViewController _reloadLibraryDataFromDevice]_block_invoke + 1084
10 SmartFinderCore 0x00000001004ad913 __44-[SSPManager fetchPhotoLibraryWithCallback:]_block_invoke + 1171
11 SmartFinderCore 0x0000000100538be0 __69-[SSPGetPhotoLibraryRequestOperation initWithSSPManager:andCallback:]_block_invoke.81 + 48
12 libdispatch.dylib 0x0000000100938070 _dispatch_call_block_and_release + 12
13 libdispatch.dylib 0x000000010092acc5 _dispatch_client_callout + 8
14 libdispatch.dylib 0x00000001009426ae _dispatch_main_queue_callback_4CF + 2845
15 CoreFoundation 0x00007fffa11409e9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
16 CoreFoundation 0x00007fffa10ff8dd __CFRunLoopRun + 1949
17 CoreFoundation 0x00007fffa10feed8 CFRunLoopRunSpecific + 296
18 HIToolbox 0x00007fff92988935 RunCurrentEventLoopInMode + 235
19 HIToolbox 0x00007fff9298876f ReceiveNextEventCommon + 432
20 HIToolbox 0x00007fff929885af _BlockUntilNextEventMatchingListInModeWithFilter + 71
21 AppKit 0x00007fff9b646df6 _DPSNextEvent + 1067
22 AppKit 0x00007fff9b646226 -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 454
23 AppKit 0x00007fff9b63ad80 -[NSApplication run] + 682
24 AppKit 0x00007fff9b604368 NSApplicationMain + 1176
25 HandShaker 0x0000000100017712 main + 34
26 libdyld.dylib 0x00007fff9e4a45ad start + 1
27 ??? 0x0000000000000003 0x0 + 3
)
</pre><pre code_snippet_id="1891872" snippet_file_name="blog_20160921_3_4390713" name="code" class="objc">
找到以下代码,root为空,便会提示这个错误。
rootRelativePath = [folder stringByReplacingOccurrencesOfString:root withString:@""];