Useful sample code from Apple
A lot of stuff was updated for Leopard, including some much needed example code. In particular I found the following two very useful…
This example demonstrates how to replicate the look and feel of Finder / Mail / iTunes “Source View” (left-handed column). If you ever tried to replicate this in Tiger, you will appreciate having this documented once and for all. It includes how to get the gradient selection, Group-Row (seen in Xcode->Target Get Info->Build Settings) and Section Headers (Devices, Places in Finder).
It also contains the very useful ImageAndTextCell class which does exactly what it says.
If you ever need to interact with the operating system as root, you need to authorize your application. This can be done several (bad) ways, but this is the (only) recommended way.
The example shows how to split your privileged code into a separate “helper tool” that once authorized, is made setuid root. It shows how to communicate between your main application and the helper tool to perform privileged operations. That said, I’m still not sure if it discusses how to do asynchronous ops (for things like tailing a root-owned, mode 0600 log file).
Before this example, the last code was a few years old and focused more on Carbon->Helper Tool integration. It also broke on the early Leopard seeds (and was the major cause of delay and frustration for Shinobi Scanner).
What Apple sample code do you highly recommend?
Tags: authorization, code, helper tool, sourceview