Debugging Hints

Now that you are writing code, not just copying it from the book, you may need some debugging hints.

Always watch the console.

If a Cocoa object throws an exception, it will be logged to the console and the event loop will be restarted. If you are not watching the console, you will not notice the error.

Always use the Debug build configuration during development.

The Release configuration has had its debugging symbols stripped. The debugger will act a bit strangely when it is dealing with a program with no debugging symbols.

Here are some common problems and common fixes:

Crash when programmatically using a view set up using Interface Builder.

You probably forgot to make a connection ...

Get Cocoa Programming for OS X: The Big Nerd Ranch 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.