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

# referenceObject(for:)

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

```
func referenceObject(for objectID: NSManagedObjectID) -> Any
```

## Parameters

`objectID`

An object ID created by the receiver.

## Return Value

The reference data used to construct objectID.

## Discussion

This method raises an <doc://com.apple.documentation/documentation/Foundation/NSExceptionName/invalidArgumentException> if the object ID was not created by the receiving store.

You should not override this method.

---

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)