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

# willAccessValue(forKey:)

Provides support for key-value observing access notification.

```
func willAccessValue(forKey key: String?)
```

## Parameters

`key`

The name of one of the receiver’s properties.

## Discussion

See [`didAccessValue(forKey:)`](/documentation/CoreData/NSManagedObject/didAccessValue(forKey:)) for more details. You can invoke this method with the `key` value of `nil` to ensure that a fault has been fired, as illustrated by the following example.

```objc
[aManagedObject willAccessValueForKey:nil];
```

---

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)