3

How could detect debug or release is running with build phases/run script?

I have four custom configuration each one duplicated from release or debug.

I found this answer but it doesn't work

    if [ "${CONFIGURATION}" = "Release" ]; then
       echo "Relese"
    else 
       echo "Debug"
    fi
Hamed
  • 1,678
  • 18
  • 30

2 Answers2

1

Verify that you have set the correct configuration in the scheme settings:

scheme settings

Usually it is set to Debug in the Run step, but in this screenshot it is set to Release for the sake of example. Otherwise your script should work.

pckill
  • 3,709
  • 36
  • 48
1

Assume these are custom configurations: CustomDebug1, CustomDebug2, CustomRelease1, CustomRelease2 Conditions should be on these configurations like this

PATH_TO_GOOGLE_PLISTS="${PROJECT_DIR}/MobileToken"

if [ "${CONFIGURATION}" = "CustomDebug1" ]; then
    echo "CustomDebug1"
fi

if [ "${CONFIGURATION}" = "CustomDebug2" ]; then
    echo "CustomDebug2"
fi

if [ "${CONFIGURATION}" = "CustomRelease1" ]; then
    echo "CustomRelease1"
fi

if [ "${CONFIGURATION}" = "CustomRelease2" ]; then
    echo "CustomRelease2"
fi
Hamed
  • 1,678
  • 18
  • 30