Contents

Introduction to Error Handling Programming Guide For Cocoa

Describes NSError objects, related Application Kit support for error handling, and how to use these features in your code.

Organization of This Document

Error Handling Programming Guide for Cocoa has the following articles:

Error Objects, Domains, and Codes describes the attributes of an NSError object, particularly its domain and error code, and discusses the possible contents of an error object’s “user info” dictionary, including localized message strings and underlying errors.

Using and Creating Error Objects explains how to evaluate an error, how to display an error message using an NSError object, and how to implement methods that return an NSError object by reference.

Error Responders and Error Recovery describes the Application Kit architecture for passing error objects up a chain of objects in an application, giving each object a chance to customize the error before it is presented. It also discusses the role of the recovery attempter, an object designated to attempt a recovery from an error if the user requests it.

Handling Received Errors discusses how, in the chain of error-responder objects, you handle a received error and customize it.

Recovering From Errors explains the procedure for attempting a user-requested recovery from an error.

The two chapters relevant to iOS are Error Objects, Domains, and Codes and Using and Creating Error Objects .

See Also

“ The Document Architecture Supports Robust Error Handling " in Document-Based App Programming Guide for Mac offers valuable advice for subclasses that override methods with a by-reference NSError parameter.

Assertions and Logging Programming Guide (both platforms)

Dialogs and Special Panels (alerts on OS X)

Sheet Programming Topics (OS X)

UIAlertView Class Reference (iOS)

Exception Programming Topics discusses how to raise and handle exceptions. Exception Handling in The Objective-C Programming Language describes the compiler directives @try , @catch , @throw , and @finally , which are used in exception handling.

Next

Copyright © 2005, 2011 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2011-01-07