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
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.