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

# committedValues(forKeys:)

Returns a dictionary of the most recent fetched or saved values of the managed object for the properties of the specified keys.

```
func committedValues(forKeys keys: [String]?) -> [String : Any]
```

## Parameters

`keys`

An array containing names of properties of the receiver, or `nil`.

## Return Value

A dictionary containing the last fetched or saved values of the receiver for the properties specified by `keys`.

## Discussion

`nil` values are represented by an instance of <doc://com.apple.documentation/documentation/Foundation/NSNull>.

This method only reports values of properties that are defined as persistent properties of the receiver, not values of transient properties or of custom instance variables.

You can invoke this method with the `keys` value of `nil` to retrieve committed values for all the receiver’s properties, as illustrated by the following example.

```objc
NSDictionary *allCommittedValues =
        [aManagedObject committedValuesForKeys:nil];
```

It is more efficient to use `nil` than to pass an array of all the property keys.

---

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)