Xcode DEBUG Mode - when is it on/off?
Solution 1
You can also "Edit Scheme" to build Debug Configuration when archiving. See screenshot of "Edit Scheme" dialog in XCode.
Solution 2
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.
soleil
Updated on July 09, 2022Comments
-
soleil almost 2 years
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"?
-
soleil over 11 yearsBut can't I also just say DEBUG=1 for Release Mode?
-
DrummerB over 11 yearsYou can. But that kind of defeats its purpose.
-
soleil over 11 yearsSo I should be able to just change "Release" to "Debug" in the Archive Build Configuration right?
-
msk over 11 yearsyes, but you have to change it to release before submitting to Apple.
-
soleil over 11 yearsI have a different scheme altogether for AppStore.
-
Vivek over 6 yearsHello @msk If I change only RUN mode in Build Configuration "release", then what should I change before submitting to APPLE ?