<!--
{
  "availability" : [
    "iOS: 3.0.0 -",
    "iPadOS: 3.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.4.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreData",
  "identifier" : "/documentation/CoreData/NSPersistentStoreCoordinator/managedObjectID(forURIRepresentation:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Data"
    ],
    "preciseIdentifier" : "c:objc(cs)NSPersistentStoreCoordinator(im)managedObjectIDForURIRepresentation:"
  },
  "title" : "managedObjectID(forURIRepresentation:)"
}
-->

# managedObjectID(forURIRepresentation:)

Returns the object identifier for the specified URI representation.

```
func managedObjectID(forURIRepresentation url: URL) -> NSManagedObjectID?
```

## Parameters

`url`

An URL object containing a URI that specify a managed object.

## Return Value

An object ID for the object specified by `url`.

## Discussion

The URI representation contains a UUID of the store the ID is coming from, and the coordinator can match it against the stores added to it.

## See Also

[`-  objectWithID:`](/documentation/CoreData/NSManagedObjectContext/object(with:))

Returns either an existing object from the context or a fault that represents that object.

[`-  URIRepresentation`](/documentation/CoreData/NSManagedObjectID/uriRepresentation())

Returns a URI that provides an archiveable reference to the object for the object ID.



---

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)