Search code examples
ioscore-datakvc

Core Data - Why does the object data stays fault even after accessing the property?


I'm using Core Data and i have a managed object that the description states its data is fault.
I try to access a property with dot syntax but it's nil.
If I use -[object valueForKey:@"key"]; the object fires fault and I get the correct value. from then on i can access using object.key and it works.

Why does the object data stays fault even after accessing the property?

EDIT: First I want to add that the property in question is of type NSDictionary and defined as Transformable in the model.

The code is simply:
NSDictionary *d = object.property; where object is a NSManagedObject that is managed by CoreData. After this line d is nil.

NSDictionary *d = [object valueForKey:@"property"]; After this line d is the correct value.


Solution

  • Had seen a similar issue a while ago. The model class had @synthesize for the properties instead of @dynamic.