CoreData relationship fault?

This isn’t an error – it is a feature of Core Data called ‘faulting’. Here is Apple’s description:

Faulting reduces the amount of memory your application consumes. A
fault is a placeholder object that represents a managed object that
has not yet been fully realized, or a collection object that
represents a relationship:

A managed object fault is an instance of the appropriate class, but
its persistent variables are not yet initialized. A relationship fault
is a subclass of the collection class that represents the
relationship. Faulting allows Core Data to put boundaries on the
object graph. Because a fault is not realized, a managed object fault
consumes less memory, and managed objects related to a fault are not
required to be represented in memory at all.

If you want to see each Unit object then you will have to specifically access them. Try the following:

for (Order *order in fetchedObjects) {
    for (Unit *unit in [order units]) {
       NSLog(@"%@", unit);
       //I am not at a computer, so I cannot test, but this should work. You might have to access each property of the unit object to fire the fault, but I don't believe that is necessary.
    }
}     

Leave a Comment