samouray
samouray

Reputation: 578

Terminating app due to uncaught exception 'NSObjectInaccessibleException', reason: 'CoreData could not fulfill a fault

I jut had this error and I searched for an answer on stack overflow but all the answers were ambiguous, I just want to know where is the line of this stack where it shows that I have an error, and how exactly can I solve it ?

*** 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) 

Upvotes: 0

Views: 940

Answers (3)

samouray
samouray

Reputation: 578

Found it,

I actually needed to add this after every save of my context :

[_MyContext processPendingChanges]

I know it was simple but it took me hours to find it

Upvotes: 0

Jody Hagins
Jody Hagins

Reputation: 28339

When a fetch generates this fault, it is usually because you have deleted an object, but the relationships were not properly updated.

This can happen if you do not declare inverse relationships in your graph. Go back and verify that each relationship has an inverse.

Check the delete rules for your relationships. If any of them are NSNoActionDeleteRule then you have made a promise to core data to manage the relationships yourself. If any of them are NSDenyDeleteRule then a deletion may be denied, and could potentially cause problems in a deep relationship hierarchy.

The other option is that you may be dong something funky in either -[HEQSiteListViewController_iPhone fetchedResultsController] or [HEQSiteListViewController_iPhone numberOfSectionsInTableView:]. Those should be pretty simple methods, so look to see if you are doing anything a bit shady or nonstandard in there.

Upvotes: 1

kirander
kirander

Reputation: 2256

The problem occurs only because of this: "The object that Core Data is trying to realize has been deleted from the persistent store". You can read more about that in Core Data Programming Guide here under "Fault cannot be fulfilled" section.

Upvotes: 2

Related Questions