Hi there, join Readernaut

Readernaut is the easiest way to share what you're reading with friends.

Join now!

97

  • Manuel read 97 pages.

11

  • Thomas read 11 pages.

945

  • Jonas read 945 kindle locations.

This chapter took longer to read than I expected. Mainly because it had so much information stuffed into it.

When using NSAssert( ), you have to distinguish between a debug and release builds because in a release build you don't want assertions checked.

To do this double click the target to bring up build info. Under build tab and 'release' selected under Configuration, add NS_BLOCK_ASSERTIONS as a value to Preprocessor Macros under GCC Preprocessing.

Use the code on this page when you want to throw an exception when an initialization is called w/o arguments.

"Following are rules that Cocoa programmers try to follow regarding initializers:

*You do not have to create any initializer in your class if the superclass's initializers are sufficient.

*If you decide to create an initializer, you must override the superclass's designated initializer.

*If you create multiple initializers, only one does the work–the designated initializer. All other initializers call the designated initializer.

*The designated initializer of your class will call the superclass's designated initializer."

About messaging in Obj-C:

*Every Obj-C object has an isa pointer to the class structure that created it. This structure contains information about the variables and implementation of methods.

*Each method in an index is associated with a selector, which is a number that is associated with a method (making selectors and methods a one-to-one relation).

*What the compiler does when it encounters a message send is that it interprets it as an objc_msgSend() function with the arguments being whatever that was in the brackets [ ] and replacing the method name with the corresponding selector number. It looks for this number in the class and if not, the super-classes.

*This dynamic structure allows programs to have classes and methods added to it while it is running.