Colin Cornaby
Colin Cornaby

Reputation: 746

CoreData crashing with fetched property in child managed object context

I have what I thought was pretty simple. There is a parent moc that is on a private queue, and a child moc that is on the main queue. The schema contains the following fetched property predicate in an entity:

    parentuuid == $FETCH_SOURCE.uuid

When I go to fetch this from within the entity's class (in the child moc on the main thread), I get an exception:

    *** Terminating app due to uncaught exception 'NSUnknownKeyException', 
    reason: '[<_NSObjectID_48_2 0x12fafb10> valueForUndefinedKey:]: 
    this class is not key value coding-compliant for the key uuid.'

I can tell basically what's going on here. For some reason CoreData has fetched an object id instead of an object, and it's trying to run the predicate on that. I don't know why that's occurring.

I've traced this to the parent/child managed object context. If I go back to just using one managed object context on the main thread, this crash stops.

Has anyone seen this before?

Upvotes: 4

Views: 460

Answers (1)

Colin Cornaby
Colin Cornaby

Reputation: 746

Contacted Apple and this is fixed in a future version of iOS.

Upvotes: 0

Related Questions