As pointed out in another question on SO (and the Apple docs), NSManagedObject
instances do not hold a strong reference to the NSManagedObjectContext
from which they originated. On first blush, this seems like a strange decision, since NSManagedObject
instances are nearly useless without their context
, since it leads to confusing bugs such as faults not firing when they should.
Can anyone provide some background on why this is the case? Would it be dangerous to implement an NSManagedObject
subclass that automatically holds a strong reference to its NSManagedObjectContext
?
Edit: thanks to great answers to this question, I've discovered that my managed objects were created against an intentionally temporary NSManagedObjectContext
by RestKit. This follows into my next question, specific to RestKit, here.