1

In Xcode build ref:

https://developer.apple.com/library/mac/#documentation/DeveloperTools/Reference/XcodeBuildSettingRef/1-Build_Setting_Reference/build_setting_ref.html#//apple_ref/doc/uid/TP40003931-CH3-SW45

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?

4

1 回答 1

1

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:

cd /Users/developer/project/resourceTest

setenv ACTION build

setenv AD_HOC_CODE_SIGNING_ALLOWED NO

setenv ALTERNATE_GROUP staff

setenv ALTERNATE_MODE u+w,go-w,a+rX

......

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.

于 2012-06-20T08:54:42.503 回答