Cocoa in the Shell

by Nyx0uf

Debug a Preference Pane with Xcode 3

Nov 26, 2009

Here is a quick tip to help you debug your Preference Pane with Xcode, because debugging with NSLog() is painful and not very productive.

So, open your project with Xcode, go to the Project menu and chose News Custom Executable.

Add a custom executable to a Xcode project

In the Executable Path field, chose /Applications/System Preferences, and for the name of the executable, chose whatever you want.

Add a custom executable to a Xcode project

Now you can put breakpoints in your code and debug it as you normally do.
When you will hit the debug button to launch your project, System Preferences will launch, then click on your Preference Pane to load it and you are good to go.

Add a custom executable to a Xcode project