obtainPermanentIDs(for:)
Converts to permanent IDs the object IDs of the objects in a given array.
Declaration
func obtainPermanentIDs(for objects: [NSManagedObject]) throwsParameters
- objects:
An array of managed objects.
Discussion
This method converts the object ID of each managed object in objects to a permanent ID. Although the object will have a permanent ID, it will still respond positively to isInserted until it is saved. Any object that already has a permanent ID is ignored.
Any object not already assigned to a store is assigned based on the same rules Core Data uses for assignment during a save operation (first writable store supporting the entity, and appropriate for the instance and its related items).
Special Considerations
This method results in a transaction with the underlying store which changes the file’s modification date.
In macOS, this results an additional consideration if you invoke this method on the managed object context associated with an instance of NSPersistentDocument. Instances of NSDocument need to know that they are in sync with the underlying content. To avoid problems, after invoking this method you must therefore update the document’s modification date (using fileModificationDate).