我突然有了这个错误,我搜索了堆栈溢出的答案,但所有的答案都含糊不清,我只想知道这个堆栈的哪一行显示我有错误,我怎么能解决这个问题 ?
*** Terminating app due to uncaught exception 'NSObjectInaccessibleException', reason: 'CoreData could not fulfill a fault for '0xd000000000080000 <x-coredata://53C0FD28-C56A-4608-A320-05A841464DBD/Site/p2>''
*** First throw call stack:
(
0 CoreFoundation 0x0000000103ca3c65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000102db2bb7 objc_exception_throw + 45
2 CoreData 0x0000000102a261fd _PFFaultHandlerLookupRow + 1949
3 CoreData 0x0000000102a25659 _PF_FulfillDeferredFault + 265
4 CoreData 0x0000000102a25437 _sharedIMPL_pvfk_core + 103
5 CoreData 0x0000000102a58513 _PF_Handler_Public_GetProperty + 163
6 Foundation 0x0000000102333914 -[NSArray(NSKeyValueCoding) valueForKey:] + 437
7 CoreData 0x0000000102a8e5af -[_PFBatchFaultingArray valueForKey:] + 79
8 Foundation 0x00000001023ada63 -[NSArray(NSKeyValueCoding) valueForKeyPath:] + 435
9 CoreData 0x0000000102a8e61f -[_PFBatchFaultingArray valueForKeyPath:] + 79
10 CoreData 0x0000000102b21ba1 __43-[NSFetchedResultsController performFetch:]_block_invoke + 481
11 CoreData 0x0000000102aefc30 gutsOfBlockToNSPersistentStoreCoordinatorPerform + 192
12 libdispatch.dylib 0x000000010489e614 _dispatch_client_callout + 8
13 libdispatch.dylib 0x0000000104884002 _dispatch_barrier_sync_f_invoke + 365
14 CoreData 0x0000000102adfec6 -[NSPersistentStoreCoordinator performBlockAndWait:] + 198
15 CoreData 0x0000000102b218dc -[NSFetchedResultsController performFetch:] + 572
16 OptiChantier 0x0000000100627930 -[HEQSiteListViewController_iPhone fetchedResultsController] + 720
17 OptiChantier 0x00000001006253ca -[HEQSiteListViewController_iPhone numberOfSectionsInTableView:] + 58
18 UIKit 0x0000000101357bbe -[_UIFilteredDataSource numberOfSectionsInTableView:] + 112
19 UIKit 0x00000001012ceac3 -[UITableViewRowData _updateNumSections] + 84
20 UIKit 0x00000001012cf4b4 -[UITableViewRowData invalidateAllSections] + 69
21 UIKit 0x000000010111a73b -[UITableView _updateRowData] + 217
22 UIKit 0x000000010113b4a5 -[UITableView _rebuildGeometry] + 27
23 UIKit 0x0000000101139c12 -[UITableView setLayoutMargins:] + 378
24 UIKit 0x0000000101139a5f -[UITableView _setDefaultLayoutMargins:] + 134
25 UIKit 0x000000010116cac5 -[UIViewController _setContentOverlayInsets:] + 317
26 UIKit 0x000000010116d3f6 -[UIViewController _updateContentOverlayInsetsFromParentIfNecessary] + 1857
27 UIKit 0x000000010116cb35 -[UIViewController _updateContentOverlayInsetsForSelfAndChildren] + 101
28 UIKit 0x0000000101174db8 -[UIViewController _updateLayoutForStatusBarAndInterfaceOrientation] + 746
29 UIKit 0x0000000101178a9b -[UIViewController viewDidMoveToWindow:shouldAppearOrDisappear:] + 873
30 UIKit 0x00000001010bd9c5 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1397
31 UIKit 0x00000001010cf48b -[UIScrollView _didMoveFromWindow:toWindow:] + 55
32 UIKit 0x00000001010bd70a -[UIView(Internal) _didMoveFromWindow:toWindow:] + 698
33 UIKit 0x00000001010b5e8f __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 125
34 UIKit 0x00000001010b5e03 -[UIView(Hierarchy) _postMovedFromSuperview:] + 437
35 UIKit 0x00000001010bff08 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1660
36 UIKit 0x00000001013a680c -[UINavigationTransitionView transition:fromView:toView:] + 479
37 UIKit 0x00000001011a4170 -[UINavigationController _startTransition:fromViewController:toViewController:] + 2984
38 UIKit 0x00000001011a4408 -[UINavigationController _startDeferredTransitionIfNeeded:] + 523
39 UIKit 0x00000001011a4ece -[UINavigationController __viewWillLayoutSubviews] + 43
40 UIKit 0x00000001012ef6d5 -[UILayoutContainerView layoutSubviews] + 202
41 UIKit 0x00000001010c29eb -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 536
42 QuartzCore 0x00000001070b7ed2 -[CALayer layoutSublayers] + 146
43 QuartzCore 0x00000001070ac6e6 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
44 QuartzCore 0x00000001070ac556 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
45 QuartzCore 0x000000010701886e _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 242
46 QuartzCore 0x0000000107019a22 _ZN2CA11Transaction6commitEv + 462
47 QuartzCore 0x000000010701a0d3 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 89
48 CoreFoundation 0x0000000103bd6ca7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
49 CoreFoundation 0x0000000103bd6c00 __CFRunLoopDoObservers + 368
50 CoreFoundation 0x0000000103bcca33 __CFRunLoopRun + 1123
51 CoreFoundation 0x0000000103bcc366 CFRunLoopRunSpecific + 470
52 GraphicsServices 0x0000000103afba3e GSEventRunModal + 161
53 UIKit 0x00000001010428c0 UIApplicationMain + 1282
54 OptiChantier 0x00000001005bff6f main + 111
55 libdyld.dylib 0x00000001048d2145 start + 1
56 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type _NSCoreDataException
(lldb)
答案 0 :(得分:1)
问题的发生仅仅是因为:“Core Data试图实现的对象已从持久性存储中删除”。您可以在“无法完成故障”部分的核心数据编程指南here中阅读更多相关内容。
答案 1 :(得分:1)
当fetch生成此错误时,通常是因为您删除了一个对象,但关系没有正确更新。
如果您未在图表中声明反向关系,则会发生这种情况。返回并验证每个关系是否有反向。
检查关系的删除规则。如果它们中的任何一个是NSNoActionDeleteRule
,那么您已经承诺核心数据以自己管理关系。如果其中任何一个为NSDenyDeleteRule
,则可能会拒绝删除,并可能导致深层关系层次结构中的问题。
另一种选择是,您可以在-[HEQSiteListViewController_iPhone fetchedResultsController]
或[HEQSiteListViewController_iPhone numberOfSectionsInTableView:]
中找到时髦的东西。这些应该是非常简单的方法,所以看看你在做那些有点阴暗或非标准的事情。
答案 2 :(得分:0)
找到它,
我实际上需要在每次保存上下文后添加它:
[_MyContext processPendingChanges]
我知道这很简单,但我需要花费数小时才能找到它