Showing posts from July, 2012

Exception Handling - Objective C

The Objective-C language has an exception-handling syntax similar to that of Java and C++. By using this syntax with the NSException, NSError, or custom classes, you can add robust error-handling to your programs. This post provides a summary of exception syntax and handling, presenting dubug information; for more details, see Exception Programming Topics.
Exception Handling : An exception is a special condition that interrups the normal flow of program execution. The class that handles exception in objective c is NSException, creating an exception object and throwing it at runtime is called throwing an exception.

Objective-C exception support involves four compiler directives@try:     Code that can potentially throw an exception is enclosed in a @try{} block.@catch: @catch{} block contains exception-handling logic for exception thrown in a @try@throw: USe the @throw directive to throw an exception, which is an Objective-C object.@finally: @finally{} block contains code that must be…