Cocoa Programming for OS X: The Big Nerd Ranch Guide
by Aaron Hillegass, Adam Preble, Nate Chandler
Runtime Errors
Despite your best efforts, things will sometimes go wrong while your app is running. In Cocoa, these errors fall into two categories.
Programmer errors are situations that should never happen, which means that they are the result of, well, a mistake you made. (We say they should never happen… but we have made plenty of these.) Examples include not meeting the precondition of a method (the index was not within the array’s bounds), performing an illegal operation (such as force-casting incorrectly or force-unwrapping a nil), or sending a message to an Objective-C object that does not understand it.
Swift alerts you to programmer errors by trapping, which results in stopping the program. Cocoa APIs use Objective-C ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access