Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 11. Exception Handling > Handling Multiple Exceptions

Handling Multiple Exceptions

You can also check for multiple exceptions. To check for multiple exceptions, you use if/else if/else in the NS_HANDLER block.

To handle multiple exceptions:

1.
Create a file named main.m.

2.
In main.m, enter the code shown in Listing 11.11.

This code checks for multiple exceptions.

3.
Enter the code to add an else block (Listing 11.12).

You’ll use this block in a later task to pass any uncaught exceptions back up the call stack.

4.
Save main.m.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial