Chapter    13

Exceptions, Signals, Errors, and Debugging

Anyone who’s done any sort of programming knows that sometimes things just don’t work out as planned. You forget to handle a specific edge case, or a system call fails in a way that’s never occurred to you, and suddenly your program blows up in your face. Every programming language and development environment has ways of dealing with these problems, and Cocoa is no exception.

This chapter will cover Cocoa’s mechanisms for creating and handling exceptions and errors, two similar-sounding but conceptually very different systems. We’ll learn the different ways that each of them is used, how to handle them, and how to initiate them ourselves. We’ll also learn how certain memory abuses can ...

Get Learn Cocoa on the Mac, Second Edition 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.