Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training

Exception handling in Objective-C

Objective-C provide exception handling to handle exceptional conditions so that code can be easier to write, easy to detect exceptions in the code and easier to maintain as well.

Ads

Exception handling in Objective-C

     

Objective-C provide exception handling to handle exceptional conditions so that code can be easier to write, easy to detect exceptions in the code and easier to maintain as well. To take support of exception handling make sure the -fobj-exceptions flag is turned on.

These are four compiler directives that are used for exception handling-
1. @try: block of code that can throw an exception.

2. @catch: define block of code to handle exception thrown by try block, this is usually an NSException object.

3. @finally: defines a block of code that executed whether an exception is thrown or not.

4. @throw: once your program detects an exception, it must propagate the exception to code that handles it. This code is called the exception handler. This entire
   process of propagating an exception is referred to as "throwing an exception?.

Figure: Flow of Exception handling in Objective-C

 

Advertisements

Ads
Share on Google+Share on Google+

Exception handling in Objective-C

Posted on: September 26, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

Ads
 

Discuss: Exception handling in Objective-C   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0

Ads

 

Ads