Show Bundle settings for debug mode only

I use this tutorial to create a simple set of settings in my application. The thing is, I want to completely hide the settings in the release version, and I cannot find a way to do this. I read this question , but it’s still not clear to me.

Thank you in advance

I managed to accomplish this by removing the Settings.bundle parameter from the target and adding this script to build the phase:

if [ ${CONFIGURATION} == "Debug" ]; then cp -r ${PROJECT_DIR}/HotelZilla/Classes/Settings/Settings.bundle ${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app fi 

But still a problem. If I uninstall the application and run it in Release Scheme mode, the preset will not appear. Then I go into Debug Scheme and rebuild, the settings appear, but if I switch to Release again, the settings are still there, so it seems that if I add the "Install to Release application" application, I can never remove the package again. Is it correct?

+4
source share
1 answer

If you use a set of parameters for your settings, you need to exclude it from the build process for your application in the release configuration. The macro #ifdef DEBUG will only help you for the code that you want to exclude from compilation - it will not help to exclude a set of parameters.

You need to add an assembly phase to enable / exclude a set of settings based on the assembly configuration you are using. Check How can I conditionally include a file based on build configuration in Xcode? , for help on this.

+6
source

All Articles