How can I add an #ifdef DEBUG to Xcode?
I have some code in a project which should never be used in the release build, but is useful when testing. I’d like to do something like this:
#ifdef DEBUG // Run my debugging only code #endif
Where do I add the DEBUG setting in Xcode 4? I tried putting it in the “Edit Scheme” under Run MyApp->Arguments Passed On Launch, but it didn’t work. Alternatively, is there a flag already available for this?
- Create object from NSString of class name in Objective-C
- Inline function “undefined symbols” error
- How can I resolve single symbol link error when dynamically linking XCode project to lib4cxx library?
- Have a dedicated UIViewController for each RootElement in MonoTouch.Dialog?
- Xamarin Visual Studio IOS Development Without a Mac?
- “f” after number/float in Objective-C/C
2 Solutions Collect From Internet About “How can I add an #ifdef DEBUG to Xcode?”
In recent Xcode project templates there’s already a
DEBUG=1 macro defined for the Debug build configuration (in the Preprocessor Macros section). You can test it using the
#if preprocessor directive.
I usually add my
-DDEBUG=1 to the OTHER_C_FLAGS section in my XCode 4 project’s build settings.
And yes, they can even discriminate between Debug / Release / ADHOC / Store builds.
- Cannot set contentSize of an UIScrollView created via loadView
- drawing routes on MKMapView
- Cordova Phonegap IOS App Settings.Bundle Possible?
- Which PHAssetCollection to use for saving an image?
- Including custom data into iOS crash dumps
- IOS: How to put some view on top of presented modal view controller?
- Adding UIBarButtonItem to UINav..Controller
- How to prepend url with http:// using stringWithFormat in Swift
- iOS Using NSDictionary to load data into section and rows
- How to make a static image appear after 3 seconds?
- How to create a grid of views with dynamic height in UITableViewCell
- How to remove numbers from a String in Swift
- iOS 7 UITableView: is it a bug or is it me?
- Selecting a word in a UITextView
- How to check network 2G or 3G in IOS?