In Xcode build ref:
It says:
ACTION
Description:
Identifier. Identifies the type of build to perform on the target.
Then I make a small script in scheme->build->pre-actions:
echo "action:"
echo ${ACTION}
But $ACTION seems empty.
I also tried other variables like $BUILD_VARIANTS and they are normal, so I’m pretty sure it’s not my script’s fault.
Does anyone have the same issue?
I’ve found the solution below:
Now I add the script in "build phases" then it worked. I also found some interesting stuff in Xcode’s build log:
So it seems Xcode set these environment variables in "build phase" but not in "post actions". You can run some scripts or send an E-mail in "post actions" but not all of these environment variables used by project are guaranteed that can be used properly.
Furthermore, you can’t get any script error message when it’s running at "post actions". Xcode also ignores these errors so your build process won’t crash.