Returns an object for a specified ID even if the object needs to be fetched.
- iOS 3.0+
- macOS 10.4+
- Mac Catalyst 13.0+Beta
- tvOS 9.0+
- watchOS 2.0+
The object for the specified ID.
If the object is not registered in the context, it may be fetched or returned as a fault. This method always returns an object. The data in the persistent store represented by
objectID is assumed to exist—if it does not, the returned object throws an exception when you access any property (that is, when the fault is fired). The benefit of this behavior is that it allows you to create and use faults, then create the underlying data later or in a separate context.
Registering and Fetching Objects
Returns the number of objects a given fetch request would have returned if it had been passed to
Passes a request to the persistent store without affecting the contents of the managed object context and returns a persistent store result.
Refreshes all currently registered objects that are associated with this context.
A Boolean value that indicates whether the context keeps strong references to all registered managed objects.
This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.Learn more about using Apple's beta software