Appendix D. Advanced Topics
Testing String Mutability with Exceptions
We can test a string’s mutability as follows. Again don’t use this for production code.
(Casting string
to id
removes a static type check warning.)
Uncaught Exceptions
Any exceptions you do not catch invoke the default exception handler. You can set your own default exception handler with NSSetUncaughtExceptionHandler
which takes as argument a pointer to a function handler. (Recall that in C, the &
operator returns the address of its argument. Thus &myHandler
is a pointer to the myHandler
function). You can obtain the system’s handler with NSGetUncaughtExceptionHandler
.
Get Sams Teach Yourself Cocoa Touch™ Programming in 24 Hours 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.