Different iOS app settings in debug / release configuration?

I am developing an application for the iPad, and recently I added several parameters (for example, debug mode switch and FPS counter switch) to the application page in Settings.app to make life easier for application testers. Of course, I do not want to save these settings in the final version. Is there a way to hide some settings in Settings.bundle in the released version, but show them in the debug version? Or, alternatively, is there a way to conditionally use another Settings.bundle parameter in my target application program, depending on whether I use the debug version or configuration to compile the application?

+5
source share
2 answers

In the project build settings, you can define the C preprocessor macro specific to each configuration. For example, I have -DDEBUGin a debug configuration that defines a macro DEBUG. Then the code can be conditionally compiled with #ifdef DEBUG ... #endif.

In addition, the Info.plist file can be pre-processed.

+3
source

I know it to the end, but it can help other people.

This is how I solved the same problem

  • Create 2 Root.plist files for Debug and one for Release.
  • Add this script run to the build process.

 if [ "$CONFIGURATION" == "Debug" ];then
    rm -f "$SRCROOT/Settings.bundle/Root.plist"
    cp "$SRCROOT/Debug/Root.plist" "$SRCROOT/Settings.bundle" 
else
    rm -f "$SRCROOT/Settings.bundle/Root.plist"
    cp "$SRCROOT/Release/Root.plist" "$SRCROOT/Settings.bundle" 

+6
source

All Articles