11. Exception Handling

Errors are a fact of life. Even the most perfect programmer has code that creates run-time errors at times. This chapter is about handling such cases.

You’ll commonly encounter two kinds of errors: compile-time errors and run-time errors. Compile-time errors are those raised by the compiler, and you have to fix those before you continue with your program. Run-time errors happen at run-time, even though your code compiled fine. Run-time errors are commonly called exceptions.

Objective-C can handle exceptions, but the way it does so varies by platform. In this chapter, we’ll use the GNUstep way of handling exceptions, which is the most common method.

Here, you use macros like NS_DURING and NS_HANDLER to handle exceptions ...

Get Objective-C: Visual QuickStart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.