Specifies a block to call when the corresponding property is not present in the user info dictionary.
- iOS 9.0+
- macOS 10.11+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
The error domain of the provider.
A block to be executed synchronously at the time a corresponding property is accessed.
The error object that is being accessed.
The user info key corresponding to the accessed property.
This method specifies a block that is called from the implementations of
help when the underlying value for any of those properties is not present in the
user dictionary of NSError instances with the specified domain.
A user info provider is optional, and allows localization and formatting of error messages to be done lazily, rather than populating the
user at the time of creation. It is expected that only the “owner” of an
NSError domain specifies the provider for the domain, and that this is done at most once. This method is not meant for consumers of errors to customize the
user entries, and should not be used to customize the behaviors of error domains provided by the system.
The keys of a provider’s
user dictionary correspond to the queried property, such as
NSLocalized for the
localized property. The provider should return
nil for any keys that it is unable to provide, as well as any keys it does not recognize (since the list of error keys may be extended in future releases). If an appropriate result for the requested key cannot be provided, return
nil rather than choosing to manufacture a generic fallback response.
The provider block is executed synchronously at the time when a corresponding property is accessed. The results are not cached.