Learning Cocoa: Creating a Preference Pane

I've been digging into Cocoa to learn how to write native applications on the Mac. Objective-C is actually pretty nice, once I get past the funky bracket syntax and the notion of sending messages instead of calling functions.

I have struggled to find good sources of help and information on the web. Maybe that is in part because this is a pretty narrow segment of developers (versus something like Ruby, Python, or C#). That being said, I have found pretty fast and good help can be found on the cocoa-dev mailing list.

I first set out to learn about and build a preference pane to capture configuration values that I want for the application I am building (more on that to come once I am ready to unveil what I have planned). In doing so I found some resources that helped quite a bit, yet left a little to be desired.

First the documentation was written for 10.4, but I was working with 10.5, so some of the screenshots were throwing me off. Second, there was one detail in particular that was troubling me and if it weren't for help from a John Stiles from the cocoa-dev listserv, I would still be spinning.

The one little trick that was keeping me spinning was un-checking "Release When Closed" on the Panel Attributes inspector page:

If you don't do that then all will work well until you got to select the application menu after closing the preference pane window. The application will freeze and then crash. Makes perfect sense now that it was pointed out to me.