NSErrorRecoveryAttempting Protocol Reference

(informal protocol)

Framework
/System/Library/Frameworks/Foundation.framework
Availability
Available in OS X v10.4 and later.
Declared in
NSError.h

Overview

The NSErrorRecoveryAttempting informal protocol provides methods that allow your application to attempt to recover from an error. These methods are invoked when an NSError object is returned that specifies the implementing object as the error recoveryAttempter and the user has selected one of the error’s localized recovery options.

Which method is invoked is dependent on how the error is presented to the user. If the error is presented in a document-modal sheet, attemptRecoveryFromError:optionIndex:delegate:didRecoverSelector:contextInfo: is invoked. If the error is presented in an application-modal dialog, attemptRecoveryFromError:optionIndex: is invoked.

Tasks

Attempting Recovery From Errors

Instance Methods

attemptRecoveryFromError:optionIndex:

Implemented to attempt a recovery from an error noted in an application-modal dialog.

- (BOOL)attemptRecoveryFromError:(NSError *)error optionIndex:(NSUInteger)recoveryOptionIndex
Parameters
error

An NSError object that describes the error, including error recovery options.

recoveryOptionIndex

The index of the user selected recovery option in error's localized recovery array.

Return Value

YES if the error recovery was completed successfully, NO otherwise.

Discussion

Invoked when an error alert is been presented to the user in an application-modal dialog, and the user has selected an error recovery option specified by error.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSError.h

attemptRecoveryFromError:optionIndex:delegate:didRecoverSelector:contextInfo:

Implemented to attempt a recovery from an error noted in an document-modal sheet.

- (void)attemptRecoveryFromError:(NSError *)error optionIndex:(NSUInteger)recoveryOptionIndex delegate:(id)delegate didRecoverSelector:(SEL)didRecoverSelector contextInfo:(void *)contextInfo
Parameters
error

An NSError object that describes the error, including error recovery options.

recoveryOptionIndex

The index of the user selected recovery option in error’s localized recovery array.

delegate

An object that is the modal delegate.

didRecoverSelector

A selector identifying the method implemented by the modal delegate.

contextInfo

Arbitrary data associated with the attempt at error recovery, to be passed to delegate in didRecoverSelector.

Discussion

Invoked when an error alert is presented to the user in a document-modal sheet, and the user has selected an error recovery option specified by error. After recovery is attempted, your implementation should send delegate the message specified in didRecoverSelector, passing the provided contextInfo.

The didRecoverSelector should have the following signature:

- (void)didPresentErrorWithRecovery:(BOOL)didRecover contextInfo:(void *)contextInfo;

where didRecover is YES if the error recovery attempt was successful; otherwise it is NO.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSError.h