<!--
{
  "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/NSManagedObjectContext/registeredObject(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Data"
    ],
    "preciseIdentifier" : "c:objc(cs)NSManagedObjectContext(im)objectRegisteredForID:"
  },
  "title" : "registeredObject(for:)"
}
-->

# registeredObject(for:)

Returns an object that exists in the context.

```
func registeredObject(for objectID: NSManagedObjectID) -> NSManagedObject?
```

## Parameters

`objectID`

The identifier of the object to retrieve. For more information, see [`NSManagedObjectID`](/documentation/CoreData/NSManagedObjectID).

## Return Value

The identified object, if it’s known to the context; otherwise, `nil`.

## Discussion

This method provides a convenient way to retrieve an object from the context’s [`registeredObjects`](/documentation/CoreData/NSManagedObjectContext/registeredObjects) property. A `nil` return value means the context doesn’t recognize the specified object; the object might still exist in the persistent store. If you need to query both the context and the store, use [`existingObject(with:)`](/documentation/CoreData/NSManagedObjectContext/existingObject(with:)) instead.

---

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)