NSObjectInaccessibleException',原因:'CoreData 无法完成错误。如何解释这个?

Posted

技术标签:

【中文标题】NSObjectInaccessibleException\',原因:\'CoreData 无法完成错误。如何解释这个?【英文标题】:NSObjectInaccessibleException', reason: 'CoreData could not fulfill a fault. How to interpret this?NSObjectInaccessibleException',原因:'CoreData 无法完成错误。如何解释这个? 【发布时间】:2014-06-26 11:59:21 【问题描述】:

我正在尝试解决这个问题。

许多答案说原因是我试图访问已删除的数据。我从不删除 coredata 中的任何内容。

但我看起来 DELETE FROM ZGAIHIT WHERE Z_PK = ?和 Z_OPT = ?在日志中。

可能是什么问题

2014-06-26 18:44:20.968 isikota[2626:4403] CoreData: sql: BEGIN EXCLUSIVE
2014-06-26 18:44:20.968 isikota[2626:4403] CoreData: sql: DELETE FROM ZGAIHIT WHERE Z_PK = ? AND Z_OPT = ?
2014-06-26 18:44:20.968 isikota[2626:4403] CoreData: sql: COMMIT
2014-06-26 18:44:24.256 isikota[2626:60b] <0xd042b70 newIsiKotaAppDelegate.m:(77)> nav.tabBarItem.title: Catalogs
2014-06-26 18:44:24.258 isikota[2626:4403] CoreData: sql: BEGIN EXCLUSIVE
2014-06-26 18:44:24.258 isikota[2626:4403] CoreData: sql: COMMIT
2014-06-26 18:44:24.259 isikota[2626:4403] CoreData: sql: SELECT COUNT( DISTINCT t0.Z_PK) FROM ZGAIHIT t0 
2014-06-26 18:44:24.259 isikota[2626:4403] CoreData: annotation: total count request execution time: 0.0006s for count of 0.
2014-06-26 18:44:24.260 isikota[2626:4403] CoreData: sql: BEGIN EXCLUSIVE
2014-06-26 18:44:24.260 isikota[2626:4403] CoreData: sql: COMMIT
2014-06-26 18:44:24.260 isikota[2626:4403] CoreData: sql: BEGIN EXCLUSIVE
2014-06-26 18:44:24.261 isikota[2626:4403] CoreData: sql: INSERT INTO ZGAIHIT(Z_PK, Z_ENT, Z_OPT, ZPARAMETERS, ZTIMESTAMP) VALUES(?, ?, ?, ?, ?)
2014-06-26 18:44:24.263 isikota[2626:4403] CoreData: sql: COMMIT
2014-06-26 18:44:25.857 isikota[2626:4907] *** Terminating app due to uncaught exception 'NSObjectInaccessibleException', reason: 'CoreData could not fulfill a fault for '0x1632fc80 <x-coredata://7D64D938-3117-4EF6-84F3-A6CB4E249B54/Business/p779>''
*** First throw call stack:
(
    0   CoreFoundation                      0x05e271e4 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x02bfc8e5 objc_exception_throw + 44
    2   CoreData                            0x0279dbeb _PFFaultHandlerLookupRow + 2715
    3   CoreData                            0x027cfe88 -[NSFaultHandler fulfillFault:withContext:] + 40
    4   CoreData                            0x027ac8b9 -[NSManagedObject(_NSInternalMethods) _newPropertiesForRetainedTypes:andCopiedTypes:preserveFaults:] + 73
    5   CoreData                            0x027ac85c -[NSManagedObject(_NSInternalMethods) _newAllPropertiesWithRelationshipFaultsIntact__] + 124
    6   CoreData                            0x027d5ea1 -[NSManagedObjectContext(_NSInternalAdditions) _committedSnapshotForObject:] + 65
    7   CoreData                            0x0284c4f6 -[NSManagedObjectContext(_NSInternalAdditions) _currentEventSnapshotForObject:] + 70
    8   CoreData                            0x027d85a2 -[NSManagedObjectContext(_NestedContextSupport) _copyChildObject:toParentObject:fromChildContext:] + 130
    9   CoreData                            0x027d81e8 -[NSManagedObjectContext(_NestedContextSupport) _parentProcessSaveRequest:inContext:error:] + 1480
    10  CoreData                            0x02850a14 __82-[NSManagedObjectContext(_NestedContextSupport) executeRequest:withContext:error:]_block_invoke + 676
    11  CoreData                            0x027d2b81 internalBlockToNSManagedObjectContextPerform + 17
    12  libdispatch.dylib                   0x02eba4d0 _dispatch_client_callout + 14
    13  libdispatch.dylib                   0x02ea7740 _dispatch_barrier_sync_f_invoke + 58
    14  libdispatch.dylib                   0x02ea73ea dispatch_barrier_sync_f + 89
    15  CoreData                            0x027d2b02 _perform + 114
    16  CoreData                            0x027d29ae -[NSManagedObjectContext(_NestedContextSupport) executeRequest:withContext:error:] + 238
    17  CoreData                            0x027ad56c -[NSManagedObjectContext save:] + 764
    18  isikota                             0x0002a0c0 __49+[BGMDCRManagedObjectContextThreadHandler commit]_block_invoke + 176
    19  CoreData                            0x027d284f developerSubmittedBlockToNSManagedObjectContextPerform + 95
    20  libdispatch.dylib                   0x02eba4d0 _dispatch_client_callout + 14
    21  libdispatch.dylib                   0x02ea7740 _dispatch_barrier_sync_f_invoke + 58
    22  libdispatch.dylib                   0x02ea73ea dispatch_barrier_sync_f + 89
    23  CoreData                            0x027d277f -[NSManagedObjectContext performBlockAndWait:] + 127
    24  isikota                             0x00029a76 +[BGMDCRManagedObjectContextThreadHandler commit] + 2758
    25  isikota                             0x00032507 +[BGFetchClass getObjectWithStringOfValue:fromTable:withAttribut:] + 935
    26  isikota                             0x0003201e +[BGFetchClass getObjectWithStringOfValue:fromTable:] + 222
    27  isikota                             0x00031ea3 __54+[BGFetchClass getObjectWithStringOfValues:fromTable:]_block_invoke + 99
    28  isikota                             0x000d8410 -[NSArray(variousDebuggingTools) convertEachElementToAnother:] + 400
    29  isikota                             0x00031dca +[BGFetchClass getObjectWithStringOfValues:fromTable:] + 154
    30  isikota                             0x000d9255 -[NSArray(variousDebuggingTools) convertDefaultSelectorsToManagedObjectWithClass:] + 69
    31  isikota                             0x0001acc6 -[BGGrabClass saveDataWithData:andIdToRequest:withDictToSave:Heavy:] + 5318
    32  isikota                             0x00020a9c -[BGGrabClass saveDataWithDataAfterGetBiz1:Heavy:] + 796
    33  isikota                             0x000210a2 -[BGGrabClass SaveDataAfterGetBiz1:] + 722
    34  isikota                             0x000212e8 -[BGGrabClass SaveDataAfterGetBiz:] + 456
    35  isikota                             0x00024444 -[BGGrabClass SaveDataWithNSArrayThatContainsID:] + 708
    36  isikota                             0x00159f84 +[BGBusinessGrabber arParseReturnID:] + 724
    37  isikota                             0x001596df +[BGBusinessGrabber vLoadObjectsWithID:] + 127
    38  isikota                             0x0007974d -[BGSearchParameter arGrabAndEncodeIDOfBusinesses] + 157
    39  isikota                             0x000792ae -[BGSearchParameter executeGrabWithCompletionBlock:] + 590
    40  isikota                             0x0007885d -[BGSearchParameter resetStartFromWithCompletionBlock:] + 541
    41  isikota                             0x00045bfa __39-[BGNearbyShortcut reloadButtonPressed]_block_invoke + 330
    42  Foundation                          0x021d4d65 -[NSBlockOperation main] + 88
    43  Foundation                          0x0222dc79 -[__NSOperationInternal _start:] + 671
    44  Foundation                          0x021aa9c8 -[NSOperation start] + 83
    45  Foundation                          0x0222ff44 __NSOQSchedule_f + 62
    46  libdispatch.dylib                   0x02eba4d0 _dispatch_client_callout + 14
    47  libdispatch.dylib                   0x02ea6fe0 _dispatch_async_redirect_invoke + 202
    48  libdispatch.dylib                   0x02eba4d0 _dispatch_client_callout + 14
    49  libdispatch.dylib                   0x02ea8eb7 _dispatch_root_queue_drain + 291
    50  libdispatch.dylib                   0x02ea9127 _dispatch_worker_thread2 + 39
    51  libsystem_pthread.dylib             0x031e9dab _pthread_wqthread + 336
    52  libsystem_pthread.dylib             0x031edcce start_wqthread + 30
)
libc++abi.dylib: terminating with uncaught exception of type _NSCoreDataException

错误发生在这里:

    PO1(arUpdatedObjects); // some objects are updated
    PO1(moc.insertedObjects);

    [moc performBlockAndWait:^
        @synchronized([BGFetchClass class])
        
            saveSuccesfully = [moc save:&error];
            if (!saveSuccesfully) 
                CLog(@"Error in Saving %@", error); //Error here
            
            else
            
        
    ];

【问题讨论】:

该错误可能来自已删除的对象,或者来自从未插入过的数据(例如,在一个上下文中插入,尝试在不同的上下文中使用对象 ID 而不首先保存更改)。该错误表示它与Business 实体的实例有关。关于如何处理这些问题的一些细节对于找出问题所在是必要的。 【参考方案1】:

首先,DELETE FROM ZGAIHIT ~ 日志记录语句来自 Google Analytics(分析)更新事件。因此,它与您自己的核心数据问题无关/或可能与您自己的核心数据问题有关,因为 Google Analytics 使用他们自己的 sql 记录。对于您的 Not Fullfil Fault Error 问题,此线程可能会有所帮助。 CoreData could not fulfill a fault for.

【讨论】:

以上是关于NSObjectInaccessibleException',原因:'CoreData 无法完成错误。如何解释这个?的主要内容,如果未能解决你的问题,请参考以下文章