<!--
{
  "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/NSCoder/decodingFailurePolicy-swift.property",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSCoder(py)decodingFailurePolicy"
  },
  "title" : "decodingFailurePolicy"
}
-->

# decodingFailurePolicy

The action the coder should take when decoding fails.

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

## Discussion

A decode call can fail 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 encountering a numeric type instead. This also occurs when [`decodeInteger(forKey:)`](/documentation/Foundation/NSCoder/decodeInteger(forKey:)) encounters a value encoded as floating-point, or vice versa.
- A secure coding violation occurs. This happens when you attempt 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 types passed to [`decodeObject(of:forKey:)`](/documentation/Foundation/NSCoder/decodeObject(of:forKey:)-roif).

---

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)