调用removeItemAtPath时崩溃

时间:2018-05-15 08:19:12

标签: ios objective-c xcode

我将在主线程上调用save(archive)和remove方法。删除后,未归档的本地失败。但是,我无法重新出现崩溃。但它似乎是大多数用户。 碰撞日志:

崩溃:com.apple.main-thread EXC_BAD_ACCESS KERN_PROTECTION_FAILURE 0x0000000170043780 - [XYPHPostModel(Manager)removeDraft:]

Crashed: com.apple.main-thread
0  (Missing)                      0x170043780 (Missing)
1  (Missing)                      0x170043780 (Missing)
2  Foundation                     0x18545555c -[NSFileManager removeItemAtPath:error:] + 84
3  discover                       0x10023fe2c -[XYPHPostModel(Manager) removeDraft:] (XYPHPostModel+Manager.m:130)
4  discover                       0x10023f4fc -[XYPHPostModel(Manager) finishPost] (XYPHPostModel+Manager.m:40)
5  discover                       0x100252024 -[XYPHPostNoteModel(Manager) setPostStatusToSuccess:] (XYPHPostNoteModel+Manager.m:600)
6  discover                       0x10025275c __43-[XYPHPostNoteModel(Manager) postToServer:]_block_invoke_2 (XYPHPostNoteModel+Manager.m:639)
7  discover                       0x10082ec3c __89-[XYAPIClient xy_requestPutWithRoute:withParams:withKeyPath:withPattern:success:failure:]_block_invoke (XYAPIClient.m:767)
8  discover                       0x100ef2428 -[XYRKHTTPSessionManager handleResponse:success:failure:] (XYRKHTTPSessionManager.m:454)
9  discover                       0x100ef0774 __78-[XYRKHTTPSessionManager putForRouteNamed:pattern:parameters:success:failure:]_block_invoke (XYRKHTTPSessionManager.m:254)
10 discover                       0x1007a5c2c __116-[AFHTTPSessionManager dataTaskWithHTTPMethod:URLString:parameters:uploadProgress:downloadProgress:success:failure:]_block_invoke.80 (AFHTTPSessionManager.m:290)
11 discover                       0x1007b8ba0 __72-[AFURLSessionManagerTaskDelegate URLSession:task:didCompleteWithError:]_block_invoke_2.150 (AFURLSessionManager.m:308)
12 libdispatch.dylib              0x18388a1fc _dispatch_call_block_and_release + 24
13 libdispatch.dylib              0x18388a1bc _dispatch_client_callout + 16
14 libdispatch.dylib              0x18388eb2c _dispatch_main_queue_callback_4CF + 428
15 CoreFoundation                 0x1849ae810 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
16 CoreFoundation                 0x1849ac3fc __CFRunLoopRun + 1660
17 CoreFoundation                 0x1848da2b8 CFRunLoopRunSpecific + 444
18 GraphicsServices               0x18638e198 GSEventRunModal + 180
19 UIKit                          0x18a9217fc -[UIApplication _run] + 684
20 UIKit                          0x18a91c534 UIApplicationMain + 208
21 discover                       0x1006bf610 main (main.m:31)
22 (Missing)                      0x1838bd5b8 (Missing)

1 个答案:

答案 0 :(得分:-1)

我认为你尝试删除一个文件,但你没有权限超过你的特定文件夹。

[NSFileManager removeItemAtPath:error:] + 84

我们需要更多背景信息,因为我们会尽力帮助您。