Tag: xcodebuild

如何将用户定义的宏传递给xcodebuild?

我在命令行中通过xcodebuild构建我的项目。 不在xCode中。 我想将一些marc传递给项目,以便它可以影响代码。 如下面的代码: #if (API_TYPE == 1) #define URL_API @”https://dapi.xxx.com/1.1/” #elif (API_TYPE == 2) #define URL_API @”https://tapi.xxx.com/1.1/” #elif (API_TYPE == 3) #define URL_API @”https://api.xxx.com/1.1/” #else #error “API_TYPE value error! should be only value 1,2,3 !” #endif 我想在代码文件之外传递API_TYPE的定义。 比如通过xcodebuild命令。 但它不像这样工作: xcodebuild -sdk xxx -target xxx SYMROOT=${XCSYMROOT} API_TYPE=${APITYPE} API_TYPE的值未更改。 但是SYMROOT的价值发生了变化。 那么我该如何实现将值传递给API_TYPE呢?