<!--
{
  "availability" : [
    "iOS: 5.0.0 -",
    "iPadOS: 5.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.7.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreData",
  "identifier" : "/documentation/CoreData/NSIncrementalStore/obtainPermanentIDs(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Data"
    ],
    "preciseIdentifier" : "c:objc(cs)NSIncrementalStore(im)obtainPermanentIDsForObjects:error:"
  },
  "title" : "obtainPermanentIDs(for:)"
}
-->

# obtainPermanentIDs(for:)

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

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

## Parameters

`array`

An array of newly-inserted objects.

## Return Value

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

## Discussion

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:)`](/documentation/CoreData/NSIncrementalStore/execute(_:with:)) with a save request, to assign permanent IDs to newly-inserted objects.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)