EXC_BAD_ACCESS on NSManagedObjectContext save method inside NSOperation and ARC, why?

后端 未结 1 1760
伪装坚强ぢ
伪装坚强ぢ 2021-01-11 23:17

I have found some problems when saving NSManagedObjectContext inside NSOperation with turned on ARC. Without ARC everything was fine before. It is always gives EXC_BAD_ACCES

相关标签:
1条回答
  • 2021-01-12 00:05

    Maybe ARC deallocates some object that receives NSManagedObjectContextDidSaveNotification and this causes the exception? I had something similar, and fixed it by making sure to removeObserver: before the object gets deallocated.

    Note that the CoreData exception actually hides the notification center exception, so you don't get to see it.

    0 讨论(0)
提交回复
热议问题