<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSKeyedUnarchiver/decodingFailurePolicy",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSKeyedUnarchiver(py)decodingFailurePolicy"
  },
  "title" : "decodingFailurePolicy"
}
-->

# decodingFailurePolicy

The action to take when this unarchiver fails to decode an entry.

```
var decodingFailurePolicy: NSCoder.DecodingFailurePolicy { get set }
```

## Discussion

The unarchiver may fail to decode an entry for the following reasons:

- The keyed archive data is corrupt or missing.
- A type mismatch occurs, such as expecting a class by calling [`decodeObject(of:forKey:)`](/documentation/Foundation/NSCoder/decodeObject(of:forKey:)-7tmft), but the unarchiver encounters a numeric value for that key instead. This also occurs when [`decodeIntForKey:`](/documentation/Foundation/NSKeyedUnarchiver/decodeIntForKey:) encounters a value encoded as floating-point, or vice versa.
- A secure coding violation occurs. This happens when attempting to decode an object that doesn’t conform to [`NSSecureCoding`](/documentation/Foundation/NSSecureCoding). This also happens when the encoded type doesn’t match any of the classes passed to [`unarchivedObject(ofClasses:from:)`](/documentation/Foundation/NSKeyedUnarchiver/unarchivedObject(ofClasses:from:)-b9t5).

---

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)