Xcode

Xcode in general

If you get a weird error, first always try to restart Xcode.

Debugging

Some tips:

No stacktrace

Sometimes, the debugger will print

 Terminating app due to uncaught exception

And then a couple of lines of meaningless numbers. This is your stacktrace, and Xcode failed to symbolicate it.

Add a breakpoint for all exceptions. In XCode 4, click menu View -> Navigators -> Show Breakpoints Navigator. Click the plus in the lower left corner, and add an Exception Breakpoint. Run the app; it should stop wherever the exception occurs.

Slow debugging

When using an iOS device running 4.2.1 on XCode 4 with the iOS 5.0 SDK, you may get the following message in the console:

 warning: Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1 (8C148)
 /Symbols/usr/lib/info/dns.so (file not found).
 warning: No copy of dns.so found locally, reading from memory on remote device.
 This may slow down the debug session.

Error 0xE8000022: service is invalid

Restart device. It simply means that the gdb session can't connect because the device is doing something else.

EXC_BAD_ACCESS

This mostly happens when you use an object that's already released for some reason. To find out, enable Zombie Objects, see also the Apple documentation Running Your Application with Diagnostics.

I've encountered the following scenarios so far:

Put version number in your app

Add this to the target its Build Phase -> Run Script

 echo -n ${TARGET_BUILD_DIR}/${INFOPLIST_PATH} \| xargs -0 /usr/libexec/PlistBuddy -c "Set :CFBundleVersion `svnversion -n`"