Having good references could save programmers a lot of time, so as a newcomer to Xcode, I want to share these tips. Note: I am using Xcode 3.1.2
Searching SDK/API on The Developer Documentation
You can search the documentation using the search field on the right side project windows (see picture below), not the search under the main Help menu.
Making It Easy To Access The Developer Documentations
These two handy shortcuts: Help and Research Assistant are buried within Xcode, make sure you know they are there.
If you don’t have them on the Toolbar, add them by right-clicking (or control-clicking) on the toolbar , selecting Customize Toolbar….
The Help opens the SDK/API Documentation when clicked (this is not the same as the main menu Help option which is the standard Finder Help) .
The Research Assistant offers a quick way to open the documentation on a particular method or classes. For example, below I highlighted a function name (CGAffineTransformMakeRotation) then clicked the Research Assistant icon, which then opens a window showing the documentation for that function.
Quickly Opening A User-Defined #import File
Right-click (or control-click) on the filename within the #import statement, then select Open in Separate Editor.
Jumping To Function Definition While Editing a *.m File
Click on the area next to the M icon below the toolbar:
A menu will show up, showing a list of functions, which you can select to jump to the function.
Viewing Class Hierarchy
Click on the Class navigation button (the one with letter C) – located on the top-right of the window, below the toolbar.
It is very handy to use. You don’t have to jump through the hoops to find super classes.
It also shows sub-classes (if any) as well.
Shortcut to see the documentation of a class or function
While editing a source file, you can press and hold down ALT button (the cursor should change into a cross-hair), then double-click on a function or class name. This will open the documentation for that function or class (if the documentation exists). For example, below I ALT+double-clicked on scheduledTimerWithTimeInterval function, which brings up the Developer Documentation for it.
Finding Cause Of Linker Error
When compiling, you might get an error like so:
“_AudioServicesPlaySystemSound”, referenced from:
-[SoundEffect play] in SoundEffect.o
“_AudioServicesDisposeSystemSoundID”, referenced from:
-[SoundEffect dealloc] in SoundEffect.o
“_AudioServicesCreateSystemSoundID”, referenced from:
-[SoundEffect initWithContentsOfFile:] in SoundEffect.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
This usually means either there’s some missing source code or missing Frameworks (Framework is Apple’s term for their core libraries – it is basically libraries). Sometimes it is not obvious which Framework is needed. If the missing Framework is a standard framework, you can usually find what it is by searching for the missing functions (do not include the underline as the underline is added by the compiler). For example, by searching for AudioServicesCreateSystemSoundID, I can see that it requires AudioToolbox framework.
I can then add that Framework the the project by expanding the Target group, select Link Binary With Libraries, select Add ->Existing Frameworks.
A dialog will popup. Click the icon on the bottom, and add select AudioToolbox.framework.