---
title: "managedObjectID(forURIRepresentation:)"
framework: coredata
role: symbol
role_heading: Instance Method
path: "coredata/nspersistentstorecoordinator/managedobjectid(forurirepresentation:)"
---

# managedObjectID(forURIRepresentation:)

Returns the object identifier for the specified URI representation.

## Declaration

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

## Parameters

- `url`: An URL object containing a URI that specify a managed object.

## Return Value

Return Value An object ID for the object specified by url.

## Discussion

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

### Related Documentation

- [object(with:)](coredata/nsmanagedobjectcontext/object(with:).md)
- [uriRepresentation()](coredata/nsmanagedobjectid/urirepresentation().md)
