Instance Method

obtainPermanentIDs(for:)

Returns an array containing the object IDs for a given array of newly-inserted objects.

Declaration

func obtainPermanentIDs(for array: [NSManagedObject]) throws -> [NSManagedObjectID]

Parameters

array

An array of newly-inserted objects.

error

If an error occurs, upon return contains an NSError object that describes the problem.

Return Value

An array containing the object IDs for the objects in array.

The returned array must return the object IDs in the same order as the objects appear in array.

Discussion

This method is called before execute(_:with:) with a save request, to assign permanent IDs to newly-inserted objects.

See Also

Manipulating Managed Objects

func execute(NSPersistentStoreRequest, with: NSManagedObjectContext?) -> Any

Returns a value as appropriate for the given request, or nil if the request cannot be completed.

func newValuesForObject(with: NSManagedObjectID, with: NSManagedObjectContext) -> NSIncrementalStoreNode

Returns an incremental store node encapsulating the persistent external values of the object with a given object ID.

func newValue(forRelationship: NSRelationshipDescription, forObjectWith: NSManagedObjectID, with: NSManagedObjectContext?) -> Any

Returns the relationship for the given relationship of the object with a given object ID.

func referenceObject(for: NSManagedObjectID) -> Any

Returns the reference data used to construct a given object ID.

Beta Software

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