xcodebuild pass arguments to application on iOS

与世无争的帅哥 提交于 2019-12-06 11:06:13

I ended up with this solution:

xcodebuild -workspace "..." -scheme "..." -sdk "..." -destination "..." -configuration Release SECRET_ARG1="$SECRET_VALUE1" SECRET_ARG2="$SECRET_VALUE2" build test;

Then in test target build settings add these values:

Finally, you can access your values using macro:

#define STRINGIZE(x) #x

#define STRINGIZE2(x) STRINGIZE(x)

Now, this will resove as NSString constant:

@STRINGIZE2(SECRET_ARG1);

When building with Travis CI you can pass your secret values to environment using project settings, or encrypt and place them inside your travis.yml file (second way is more flexible and allows you to use different secret values inside one travis.yml file, but it's not so fast and convenient)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!