Just a quick reminder for myself for creating localization files in the terminal for xcode projects.
cd to project directory.
find . -name \*.m | xargs genstrings -o en.lproj
The above will find all .m files in all subdirectories and extract the NSLocalizedString().
Just a quick list of the most useful breakpoints I have found for debugging purposes. This is more of a personal reference so that I can add them back to any new install of Xcode.
In addition here is a great tech paper on debugging in xcode called Mac OS X Debugging Magic
I came across this method for creating a Debug Logger for XCode projects.
Basically you create a macro that says only process this piece of code if we are running in debug mode. This allows you to create logging throughout your application without having to worry about removing it before you do a release build as it won't be included in the release code.
To begin you need to add a GCC_PREPROCESSOR_DEFINITIONS | DEBUG=1 to your projects TARGET>Get Info>BUILD settings.
Next go into YOUR_APPLICATION_NAME_Prefix.pch file ( located under Other Sources ) and place the following macro.
- #ifdef DEBUG
- # define trace(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
- # define trace(...)
This will create a custom Logger that can be used in the same way as NSLog except that it will output a more descriptive message showing the location and line number of where the log item is located.
edit: I have cheekily renamed it to trace();
- trace( @" Does my debug tracer appear in production code? %@",
- @"NO!" );
After using eclipse for so long i have become a custom to my shortcuts and xcode just doesn't stand up to the job as far as i am concerned so here is a small list of the custom key bindings i have setup for myself. I will add more as I create them.
To create a custom key bindings file goto XCode>Preferences>Bindings> Duplicate an existing binding and name it whatever you want then go to and open the file you just created in a text editor so you can see the xml output.
~/Library/Application Support/Xcode/Key Bindings/*.pbxkeys
A good list of available commands can be found here
1. Duplicate code!
I can't believe xcode doesn't have this in Eclipse you simple select your text and press Ctrl + Alt and either Up or Down on the keypad and it will duplicate your code placing it either above or below the current selection. It will also reselect the newly duplicated code so that you can duplicate it as many times as you like.