Core Data -existingObjectWithID:error: causes error 133000

后端 未结 5 1209
暗喜
暗喜 2021-01-30 21:11

My app uses Core Data (with some help of Magical Record) and is rather heavily multithreaded using NSOperation.

Of course I am very careful to only pass aro

5条回答
  •  时光说笑
    2021-01-30 21:42

    The problem is that NSManagedObjectID you pass is temporary. You can check it by calling NSManagedObjectID's isTemporaryID method. From docs:

    Returns a Boolean value that indicates whether the receiver is temporary.

    Most object IDs return NO. New objects inserted into a managed object context are assigned a temporary ID which is replaced with a permanent one once the object gets saved to a persistent store.

    You should first save your changes to persistent store, only then get a permanent ID to pass to other context.

提交回复
热议问题