Solving CoreData error: NULL _cd_rawData but the object is not being turned into a fault

后端 未结 3 1687
粉色の甜心
粉色の甜心 2021-02-07 23:12

Sometimes while using Core-Data object the app crashes with the error:

CoreData: error: NULL _cd_rawData but the object is not being turned into a fault

3条回答
  •  借酒劲吻你
    2021-02-07 23:42

    I have encountered this problem in my code as well. Later I noticed that I used a managed object created by main thread NSManagedObjectContext in background thread. Since managed object is notoriously thread unsafe so I changed my code and then this bug never appeared again and code works very well. So I guess this is IOS's way of complaining using managed object in threads other than the thread it has been created or fetched.

    Hope this help.

提交回复
热议问题