I have noticed that this works in dev mode (testing on the simulator, etc):
#ifdef DEBUG //do stuff #endif
But when I archive and distribute test builds, the app does not act in DEBUG mode even though I'm still building with the developer profile. I would like DEBUG mode to always be the case unless I build with the deployment profile and submit to Apple.
For example, when sending test builds out, I don't want to make people buy an in-app purchase, so I do something like this:
- (BOOL)isUpgradePurchased { #ifdef DEBUG return YES; #endif //do the real stuff to determine if purchased and return YES or NO }
So do I also need to set a preprocessor macro DEBUG=1 for "Release"?
When you run an application in Xcode, the debugger is automatically started and attached to the process of the application. Click the Run button in the top left or press Command + R. From the moment the application is up and running, we can start inspecting the process and, if necessary, debug it.
To create a release build, you have to edit your current scheme (⌘<) and highlight "Run [name of application]. On the right, select "Build Configuration" and choose "Release". Build as usual.
Specify Where to Pause Your App Xcode displays a breakpoint icon to indicate the location. Drag a breakpoint up or down to move it to another location; drag it away from the gutter to remove it. Click the breakpoint icon in the debug area toolbar to activate or deactivate all breakpoints.
The current version of Xcode automatically sets the DEBUG
macro in new projects. It does this only for Debug build mode however.
You can edit this in your projects Build Settings.
I recommend you add a new, separate macro instead of editing the DEBUG one. Maybe you could add a DISTRIBUTION
or DEPLOYMENT
macro only for the release mode.
You can also "Edit Scheme" to build Debug Configuration when archiving. See screenshot of "Edit Scheme" dialog in XCode.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With