Why might releasing a managed object crash in -[_PFManagedObjectReferenceQueue _queueForDealloc:]?

前端 未结 4 1480
你的背包
你的背包 2020-12-31 19:37

I am occasionally seeing crashes with a stack trace like this:

0 libobjc.A.dylib 0x97dc0edb objc_msgSend + 27
1 com.apple.CoreData 0x97edcdc2 -[_PFManagedObj         


        
4条回答
  •  星月不相逢
    2020-12-31 19:39

    -_queueForDealloc: is an undocumented internal method. It shows up in stacks from time to time but it's nothing we deal with directly.

    Your problem is most likely caused by over-releasing a managedObject. A managedObject will be strongly retained by a context that inserts, updates or changes the object so if you micromanage the objects own retention, you can over-release it prior to the context releasing it. This cause the managed object to disappear at seemingly at random. Conversely, you can over-retain causing an object to persist after the context has deleted it.

    I encourage people to avoid retaining managed objects but when you do, put them a class property or a collection like an array or set. That way, the retention is handled for you.

提交回复
热议问题