Question

Could anyone please explain the meaning of "fault" for me?

Here is the documentation of "Faulting Behavior" from Core Data Performance Doc by Apple.

Faulting Behavior

Firing faults can be a comparatively expensive process (potentially requiring a round trip to the persistent store), and you may wish to avoid unnecessarily firing a fault. You can safely invoke the following methods on a fault without causing it to fire: isEqual:, hash, superclass, class, self, zone, isProxy,isKindOfClass:, isMemberOfClass:, conformsToProtocol:, respondsToSelector:, description, managedObjectContext, entity, objectID, isInserted, isUpdated, isDeleted, and isFault.

Since isEqual and hash do not cause a fault to fire, managed objects can typically be placed in collections without firing a fault. Note, however, that invoking key-value coding methods on the collection object might in turn result in an invocation of valueForKey: on a managed object, which would fire a fault. In addition, although the default implementation of description does not cause a fault to fire, if you implement a custom description method that accesses the object’s persistent properties, this will cause a fault to fire.

Note that just because a managed object is a fault, it does not necessarily mean that the data for the object are not in memory—see the definition for isFault.

Thank you!!

Was it helpful?

Solution

In general terms, a fault is a description of the situation where you have a reference to some data but that data isn't actually in memory (so it isn't immediately available and will need to be fetched from somewhere else).

So, you have a managed object instance, but you can only call a few methods on it without causing additional data to be collected and loaded into memory.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top