O'Reilly logo

Objective-C Quick Syntax Reference by Matthew Campbell

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

CHAPTER 26

image

Error Handling

Error Handling Defined

When programs encounter unexpected errors, they behave unexpectedly or stop working altogether. Ideally, programmers would find and fix all bugs before programs are used, but there are some situations were programmers don’t have control of the entire situation. For instance, errors can happen when programs require resources like files or web sites that are no longer present.

The best practice in dealing with situations like this is to add error handling to a program. This means that when an error occurs, the program can recover or gracefully shutdown. NSError is the Foundation class that programmers ...

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