Type Method

errorWithDomain:code:userInfo:

Creates and initializes an NSError object for a given domain and code with a given userInfo dictionary.

Declaration

+ (instancetype)errorWithDomain:(NSErrorDomain)domain code:(NSInteger)code userInfo:(NSDictionary<NSErrorUserInfoKey, 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 be nil. See Error Domains for a list of predefined domains.

code

The error code for the error.

dict

The userInfo dictionary for the error. userInfo may be nil.

Return Value

An NSError object for domain with the specified error code and the dictionary of arbitrary data userInfo.

See Also

Creating Error Objects

- initWithDomain:code:userInfo:

Returns an NSError object initialized for a given domain and code with a given userInfo dictionary.