这是我正在使用的代码行,这导致了问题:
[self.managedObjectContext deleteObject:object];
然后当它保存上下文时,它会导致崩溃:
Terminating app due to uncaught exception 'NSObjectInaccessibleException', reason: 'CoreData could not fulfill a fault'
编辑:使用“-com.apple.CoreData.SQLDebug 1”运行代码。
CoreData: sql: BEGIN EXCLUSIVE
CoreData: sql: DELETE FROM ZENTRY WHERE Z_PK = ? AND Z_OPT = ?
CoreData: sql: COMMIT
CoreData: sql: SELECT 0, t0.Z_PK, t0.Z_OPT, t0.ZCREATIONDATE, t0.ZMESSAGE, t0.ZSECTIONIDENTIFIER, t0.ZVERSION FROM ZENTRY t0 WHERE t0.Z_PK = ?
CoreData: annotation: sql connection fetch time: 0.0042s
CoreData: annotation: total fetch execution time: 0.0096s for 0 rows.
CoreData: annotation: fault fulfilled from database for : 0x209010 <x-coredata://[edited out long code here]/Entry/p34>
*** Terminating app due to uncaught exception 'NSObjectInaccessibleException', reason: 'CoreData could not fulfill a fault'
不确定这是否有助于找出问题所在?