O'Reilly logo

Cocoa in a Nutshell by James Duncan Davidson, Michael Beam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

NSException — Mac OS X 10.0

Synopsis

This class implements the Foundation framework’s exception-handling system. Exceptions are used in Cocoa as a mechanism to deal with special conditions in the execution of a program that may require special handling. Clients can use NSException objects to raise exceptions (creating a special condition), as well as to retrieve information about an exception. For details on exception handling, see Chapter 2.

image with no caption

@interface NSException : NSObject <NSCoding, NSCopying>
                                  // Convenience Constructors
   + (NSException *)exceptionWithName:(NSString *)name 
                                 reason:(NSString *)reason 
                                 userInfo:(NSDictionary *)userInfo;
                                  // Initializers
   - (id)initWithName:(NSString *)aName 
                                 reason:(NSString *)aReason 
                                 userInfo:(NSDictionary *)aUserInfo;
                                  // Class Methods
   + (void)raise:(NSString *)name 
                                 format:(NSString *)format 
                                 arguments:(va_list)argList;
   + (void)raise:(NSString *)name 
                                 format:(NSString *)format, ...;
                                  // Instance Methods
   - (NSString *)name;
   - (void)raise;
   - (NSString *)reason;
   - (NSDictionary *)userInfo;
                                  // Methods Implementing NSCoding
   - (void)encodeWithCoder:(NSCoder *)aCoder;
   - (id)initWithCoder:(NSCoder *)aDecoder;
                                  // Methods Implementing NSCopying
   - (id)copyWithZone:(NSZone *)zone;

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required