Returns an NSError
object initialized for a given domain and code with a given user
dictionary.
SDKs
- iOS 2.0+
- macOS 10.2+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Foundation
Declaration
- (instancetype)initWithDomain:(NSError Domain)domain code:(NSInteger)code userInfo:(NSDictionary<NSError User Info Key, id> *)dict;
Parameters
domain
The error domain—this can be one of the predefined
NSError
domains, or an arbitrary string describing a custom domain.domain
must not benil
. See Error Domains for a list of predefined domains.code
The error code for the error.
dict
The
user
dictionary for the error.Info user
may beInfo nil
.
Return Value
An NSError
object initialized for domain
with the specified error code
and the dictionary of arbitrary data user
.
Discussion
This is the designated initializer for NSError
.