The CoreData ratio returns _NSCoreDataTaggedObjectID

I access the main data object through a link to:

pArret.zzone?.libelle 

The first object has a To-one relationship with the second, and libelle is a property of the second object.

I get the following error: -[_NSCoreDataTaggedObjectID libelle]: unrecognized selector sent to instance 0xd00000000e30000c . I do not understand what this private _NSCoreDataTaggedObjectID class is and why I am not getting a subclass of NSManagedObject as expected ?!

+6
source share
1 answer

Check out your KVO. In my case, this was because I used addObserver with NSKeyValueObservingOptionOld and a custom property method that has a keyPathsForValuesAffecting method, and in its recipient I accessed the relationship property. The KVO mechanics NSKeyValueWillChangeBySetting calls the getter as the object is reset (all setters are called by the calling values) and is executed so early that the relationship object is not loaded yet. The first attempt at a workaround was to directly monitor the keys involved in keyPathsForValuesAffecting , instead of the name of the custom property key.

0
source

All Articles