---
title: "referenceObject(for:)"
framework: coredata
role: symbol
role_heading: Instance Method
path: "coredata/nsincrementalstore/referenceobject(for:)"
---

# referenceObject(for:)

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

## Declaration

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

## Parameters

- `objectID`: An object ID created by the receiver.

## Return Value

Return Value The reference data used to construct objectID.

## Discussion

Discussion This method raises an invalidArgumentException if the object ID was not created by the receiving store. You should not override this method.

## See Also

### Manipulating Managed Objects

- [execute(_:with:)](coredata/nsincrementalstore/execute(_:with:).md)
- [newValuesForObject(with:with:)](coredata/nsincrementalstore/newvaluesforobject(with:with:).md)
- [newValue(forRelationship:forObjectWith:with:)](coredata/nsincrementalstore/newvalue(forrelationship:forobjectwith:with:).md)
- [obtainPermanentIDs(for:)](coredata/nsincrementalstore/obtainpermanentids(for:).md)
- [newObjectID(for:referenceObject:)](coredata/nsincrementalstore/newobjectid(for:referenceobject:).md)
