views:

331

answers:

2

After developing in VS.NET for many years, I'm starting to do some Xcode development and I'm very much hard-wired to the VS.NET way of doing things.

I'm not looking for a debate about which environment is better, but some productivity tips when moving from one to the other.

Does anyone have tips, keyboard settings, etc that they found useful when first moving from VS.NET to Xcode?

+2  A: 

Spend some time learning Xcode's keyboard shortcuts. Every time you want to do something like build your project, open the breakpoints window, etc, once you find it in the menu make a note of the keyboard shortcut and start using that instead.

Also, note the Switch to Header/Source File command in the view menu. This lets you jump from the .h you're currently viewing to the .m file and vica versa. The default shortcut is command-option-up arrow. This is probably my most frequently used shortcut.

Back and Forward are similarly command-option-left arrow and command-option-right arrow, respectively.

Lawrence Johnston
+3  A: 

Spend some time learning how to use Xcode's debugger, especially from the Console (Command-Shift-R). I also recommend making the Console come up any time you start your program from Xcode via Preferences(cmd-,)->Debugging->On Start->Show Console.

You can set a breakpoint that gets hit any time an exception is thrown by opening the breakpoint window (cmd-option-B) and double clicking "Double-Click For Symbol and entering objc_exception_throw.

Any time you're stopped in the debugger, you can print the description for any object in scope by entering po objectname or any primitive via p (type)primitivename at the (gdb) prompt in the console. As an example, po self any time you're stopped inside a method will print the description for the object containing the method, whereas p self will print the pointer type and address for same.

You can even call methods on any object in scope this way, for example if there's a myobject object which has a method with signature -(int)myMethod you can call it using p (int)[myObject myMethod]. Great for dynamically debugging an issue.

Lawrence Johnston