Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show Settings Bundle only for Debug Mode

I'm using this tutorial to create a simple Settings Bundle in my app. The thing is that I want to hide the settings entirely in the release version and I cannot find a way to do it. I've read this question but it's still not clear to me.

Thanks in advance

I manage to accomplish this removing the Settings.bundle from target and adding this script to Build Phase:

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

But there's still a problem. If I remove the app then launch it in Release Scheme mode, the settings bundle doesn't appear. Then, I change into Debug Scheme and rebuild, the settings appear but, if then I switch again to Release, the settings are still there, so it seems that if I add a Setting to the Release app I can never delete the bundle again. Is that right?

like image 295
Chompas Avatar asked Jan 10 '13 20:01

Chompas


1 Answers

If you're using a settings bundle for your settings, you need to exclude it from the build process for your app in the release configuration. A #ifdef DEBUG macro will only help you for code that you want to exclude from compilation - it won't help excluding a settings bundle.

You need to add a build phase to include/exclude your settings bundle based on the build configuration you're using. Check out How can I conditionally include a file based on build configuration in Xcode? for help with doing this.

like image 128
rickerbh Avatar answered Sep 27 '22 21:09

rickerbh