How can I conditionally include a file based on build configuration in Xcode?

I finally figured it out.

For each target for which you want to conditionally include the settings bundle, choose its Project from the source list, choose the target, and switch to the “Build Phases” tab.

Click the “Add Build Phase” button and choose “Add Run Script”.

Then enter the following for the script:

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

Leave a Comment