First printing (corrected)
The tech reviewers were really very good. They had some subtle and other not so subtle suggestions. I’ve tried to include all that I could and this final pass through the book has included more changes than I would have anticipated.
The book is off to indexing now and then to copy edit. I’ll have one more chance to touch it up here or there so if you have small comments to make on the errata page please do. Then it’s off to typesetting and to the printer.
The book is now content complete. I’m sending it to tech review and inviting you to submit as many errata as you can in the next couple of weeks. The last round of errata was amazing—some of you caught some very subtle things and all of them made the book better.
In this beta I’ve added three chapters and two of them are Snow Leopard only. There’s a new chapter on blocks and two on concurrency. The short story is, if you can use operation queues for concurrency that’s the way you should go. If you can’t then Snow Leopard has added Grand Central Dispatch and you’ll use a combination of dispatch queues and blocks to make your apps more responsive.
This beta was all about magic. I revised the chapters on KVC, KVO, Bindings, and Core Data. This is some seriously cool material and I think I mostly got it right last time. I’ve also added a chapter on Categories. This was way earlier in a previous version of the book but I think it works better late.
I’ve revised all of the examples to work with Snow Leopard and to leverage the new Cocoa template. This allowed me to better focus on the separation between model, view, and controller which really helps explain this material. Also, this time through we’re assuming that you have garbage collection turned on. This unearthed a subtle bug that someone submitted as an errata a while back. I couldn’t ignore it by saying &lquot;turn gc off&rquot; and the fix turned out to follow immediately from a picture I’d included. That’s a long way of saying thanks for submitting the errata and the fix and explanation worked out great.
I’ve removed some of the material in the bindings and Core Data chapters. It slowed the flow down and didn’t help you see where we were going. The intent of the removed material in Bindings was to show you the bad way before seeing the good way. I’ve done that a lot in this book but it just didn’t work here. So much work was spent setting up the bad way that you had to wonder who would do it that way. I removed some material in Core Data on how to access the back end store from the command line using SQLite. The material was all about SQLite commands and had nothing to do with the rest of the book.
Again, I’ve responded to all of the errata in this beta. I’d love more errata from you. Up next is blocks and queues and then that should be it for the book.
In this beta I’ve revised the second third of the book. The changes were a lot deeper than I anticipated. Along the way I rearchitected the running example and I think it worked out for the better. There is less fussing with glue code along the way and it is easier for me to focus on the code that underlines the concepts being taught.
I’ve added material to the notifications chapter so that in addition to registering for notifications, you are issuing some of your own. I’ve then taken the material on protocols and revised it so that you can create your own delegate that conforms to a protocol we design. There are some minor changes to the dictionaries chapter.
I’ve split the multiple nibs chapter into two pieces. In the first we split the nib into three pieces and get a better feel for File’s Owner, view controllers, and the window controller. This also let me clean up the custom view and tables chapters. I think this also helped streamline the persistence chapter. I this section with the second half of the multiple nibs chapter. I think it makes more sense here. You see how easy it is to swap out your view from the view controller.
Some of you submitted really good errata—-I’ve responded to all of them in this beta. I’d love more errata from you. I’ve left a Revision Marker and the end of this section. If there are topics you think I need to add to the third section please let me know in the forums.
Daniel writes an epic change history. I goes something like this…
I should know better.
I thought it would be a quick pass to support Xcode 3.2 and Snow Leopard in the Cocoa book. It turns out, there are a ton of changes to Xcode, Interface Builder and the templates. I ended up rethinking and reorganizing the material. Once I got going, I just couldn’t stop.
I’m sure you know how it is.
So in this beta I begin with the example of the web browser that you create without writing any code and then take you through Objective-C style messages as before. But then I continued working with code and moved up and rewrote the chapter on classes and objects. Properties are more than just a convenience, you should be using them everywhere so I moved material and added examples to cover Properties in its own chapter. Similarly, memory management deserved its own chapter. Sure you can (and should) just turn on garbage collection for desktop apps, but the material you’re learning in this book applies to iPhone development as well where you won’t have a garbage collector. So you’ll find an iPhone example that lets us look at reference counting, autorelease, and some of the tools that Apple provides for finding memory leaks.
The next four chapters followed the thread of working with one foot in code and the other in Interface Builder. There’s a new chapter (built around existing material) on outlets and actions and the controller chapter has been revised because of the new Xcode Cocoa template. The Delegates chapter was revised and a bit expanded and I’ve rethought the iPhone Browser chapter as well.
Much of the code is new and all of the images have been reshot. I’ve put in a marker so you can see where the revisions have stopped for now. I’m pausing to rest for a minute while I think of how to revise the next arc. I’m thinking of adding blocks to the discussion of collections and notifications.
I cover some of the differences if you are using and targeting 64 bit machines and, although you can still follow along if you have Leopard installed, the instructions have been updated to support Snow Leopard. You don’t need to be targeting Snow Leopard but you should be running it and using the updated tools.
Oops—we wrote the iPhone chapter, but forgot to include it in the book.
This release now includes it. Sorry for the fire drill.
In this beta you’ll find a new iPhone chapter with the Simple Browser example reworked to run on your iPhone. Most of the ideas and APIs are the same. I’ve mainly included it because it emphasizes delegates and introduces you to using properties before you create some of your own.
For the next month and a half we’re going to need to go quiet while I revise the book for Snow Leopard and the new version of Xcode. If you have ideas of topics you’d like to see covered, feel free to post it on the forums (again without violating NDA). When Snow Leopard goes public we’ll immediately ship a beta with all of the new material.
Fix pending errata
Happy New Year. I have three new chapters for you in this beta as we wrap up our running example that uses notifications from applications as they launch and terminate.
First we look at two Objective-C mechanisms for reorganizing and cleaning up your code: Categories and Protocols. Categories are like mix-ins. They let you add methods to existing classes—-even classes that you didn’t write and don’t have the source code for. Protocols are like Java interfaces. You’ve used protocols earlier and now you will create one.
Next, we will display dynamic information in a table. You’ll use everything from delegates to dictionaries. Much of what you’ve learned so far will come together in this chapter. We’ll also take a look ahead when you pull information from the column’s identifier and use it to specify which method you call.
So far our applications start over every time they launch. In the final added chapter I show you how to save your data to disk in two different ways: as plists and as binary archives. We also look at how you can set, save, and use two levels of preferences for your application.
We’ve also addressed the pending errata.