4th Ed with OS X 10.6 and Xcode 4.2


In theory one should be able to do these exercises with OS X 10.6 and Xcode 4.2, while ARC is mostly available in this configuration, it looks like some code changes are required. For example, instead of using “weak” one has to use “unsafe_retained”. I am also getting linking errors “ld: file not found: /Developer/usr/lib/arc/libarclite_macosx.a”, which suggests that OS X 10.6 does not have all that is necessary for the exercises to work. The options are

  1. use manual reference counting (an interesting exercise)
  2. upgrade to Lion
  3. try to get it to work with ARC.

Is option 3 possible?


AFAIK Option 3 (“Get it to work with ARC”) is not possible with 10.6.

I’m also going through the book with 10.6/ XCode 4.2.
Option 2 (upgrade to Lion) was not attractive to me just now. It is inevitable, but since Lion is slower and I still use some Rosetta apps I’m really in no rush.

I’ve been doing Option 1: rock it old school with retain/release.

If you use turn on Zombies and use XCode’s “Analyze” static analysis you will find most of the problems. Crashes have helped me find the rest. :wink: Aside from one weird thing in Chapter 15 (still not sure when to release/not leak the panel inside the block) I have not had any problems.