<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSException/init(name:reason:userInfo:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSException(im)initWithName:reason:userInfo:"
  },
  "title" : "init(name:reason:userInfo:)"
}
-->

# init(name:reason:userInfo:)

Initializes and returns a newly allocated exception object.

```
init(name aName: NSExceptionName, reason aReason: String?, userInfo aUserInfo: [AnyHashable : Any]? = nil)
```

## Parameters

`aName`

The name of the exception.

`aReason`

A human-readable message string summarizing the reason for the exception.

`aUserInfo`

A dictionary containing user-defined information relating to the exception

## Return Value

The created `NSException` object or `nil` if the object couldn’t be created.

## Discussion

This is the designated initializer.

## See Also

[`+  exceptionWithName:reason:userInfo:`](/documentation/Foundation/NSException/exceptionWithName:reason:userInfo:)

Creates and returns an exception object .



---

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)