我的一些用户在执行保存时遇到CoreData错误。我还没有能够在网上找到有关此错误的任何信息或如何表示堆栈跟踪。
错误消息为attempt to recursively call -save: on the context aborted, stack trace
,下面有完整的错误消息。
任何人都有关于如何弄清楚出了什么问题的任何提示或想法?
Error Domain=NSCocoaErrorDomain Code=132001 "(null)" UserInfo={message=attempt to recursively call -save: on the context aborted, stack trace=(
0 CoreData 0x0000000188cbe70c + 164
1 Primetime 0x0000000100077ea4 Primetime + 130724
2 Primetime 0x00000001000ae988 Primetime + 354696
3 Primetime 0x0000000100081674 Primetime + 169588
4 Primetime 0x00000001000802ac Primetime + 164524
5 CoreData 0x0000000188d8bbd4 + 4568
6 CoreData 0x0000000188d8a9ec + 124
7 CoreFoundation 0x00000001869ac24c + 20
8 CoreFoundation 0x00000001869ab950 + 400
9 CoreFoundation 0x00000001869ab6cc + 60
10 CoreFoundation 0x0000000186a187bc + 1504
11 CoreFoundation 0x00000001868ef32c _CFXNotificationPost + 376
12 Foundation 0x000000018738296c + 68
13 CoreData 0x0000000188cc16e8 + 724
14 CoreData 0x0000000188d43ca4 + 1336
15 CoreData 0x0000000188cbfd04 + 2116
16 CoreData 0x0000000188cbe808 + 416
17 Primetime 0x0000000100077ea4 Primetime + 130724
18 Primetime 0x0000000100089968 Primetime + 203112
19 Primetime 0x00000001001d47c0 Primetime + 1558464
20 libdispatch.dylib 0x0000000186459058 + 24
21 libdispatch.dylib 0x0000000186459018 + 16
22 libdispatch.dylib 0x000000018645dbcc _dispatch_main_queue_callback_4CF + 1000
23 CoreFoundation 0x00000001869bfc48 + 12
24 CoreFoundation 0x00000001869bd834 + 1660
25 CoreFoundation 0x00000001868ed764 CFRunLoopRunSpecific + 292
26 GraphicsServices 0x00000001882f0198 GSEventRunModal + 180
27 UIKit 0x000000018c8668d0 + 664
28 UIKit 0x000000018c86163c UIApplicationMain + 208
29 Primetime 0x00000001000ada1c Primetime + 350748
30 libdyld.dylib 0x00000001864905b8 + 4
答案 0 :(得分:21)
我遇到了与Xcode8 / ios10相同的问题。问题是由于调用在以下方法中保存核心数据上下文。
- (void)controllerDidChangeContent:(NSFetchedResultsController *)controller {
[self methodCallingSaveContext];
}
methodCallingSaveContext
调用save core数据上下文。 为了打破递归调用,我按以下方式重写了该方法:
- (void)controllerDidChangeContent:(NSFetchedResultsController *)controller {
dispatch_async(dispatch_get_main_queue(), ^{
[self methodCallingSaveContext];
});
}
现在一切都恢复了。