Contents

shouldDeleteInaccessibleFaults

A Boolean value that determines whether the context turns inaccessible faults into deleted objects.

Declaration

var shouldDeleteInaccessibleFaults: Bool { get set }

Discussion

Use this property to control how the context behaves when it encounters an inaccessible fault — an object with no underlying data in the persistent store. For example, you might fetch an object that has a to-many relationship, but then a background context deletes the related objects from the store before you traverse that relationship.

When this property is set to true, the context returns a managed object with the following characteristics:

  • The object’s attributes, including scalars, nullable, and mandatory attributes are all set to nil or 0.

  • The object’s isDeleted property is set to true, which adds the object to the context’s deletedObjects set.

  • The object is exempt from validation rules, including optionality, because the object is nonexistent and the context discards it when you next call save() or reset().

When the context returns an object with these characteristics, your app can continue running and process this object in the same way as any other deleted object.

When this property is set to false, the context throws an exception.

The default value is true.

See Also

Handling managed objects