Xcode 4构建方案脚本的设置变量 [英] Xcode 4 build setting variables for scheme scripts

查看:106
本文介绍了Xcode 4构建方案脚本的设置变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我还是习惯了Xcode 4,所以请原谅我这是一个愚蠢的问题:



在以前版本的Xcode中,可以使用任何一个在与构建关联的任何shell脚本中构建设置变量(例如SRCROOT或PRODUCT_NAME等)。通过向任何目标添加运行脚本构建阶段可以轻松实现。



<但是,在Xcode 4中,添加方案(顺便说一下,真的很棒)似乎不允许使用任何这些变量。这是否可能是设计的?是否有解决方法?

解决方案

在Xcode 4.2的运行脚本方案操作中,有一个从......提供构建设置下拉菜单,您可以在其中选择一个您希望从中获取环境变量的目标。请参见下面的屏幕截图:





除此之外,如果你选择无,Xcode会设置一堆环境变量。您可以通过执行类似 printenv>的操作来发现所有这些内容。 〜/ Desktop / printenv.txt 将它们转储到文本文件中。



一些更有用的环境变量包括 ARCHIVE_PATH SCHEME_NAME USER ARCHIVE_DSYMS_PATH ARCHIVE_PRODUCTS_PATH


I'm still getting used to Xcode 4, so forgive me if this is an asinine question:

In previous versions of Xcode, one could use any of the build setting variables (such as SRCROOT or PRODUCT_NAME, etc in any shell scripts associated with a build. This was easily accomplished by adding a 'Run Script' build phase to any target.

In Xcode 4, however, the addition of schemes (really great, by the way) seems to disallow the usage of any of these variables. Is it possible this is by design? Is there a workaround?

解决方案

In the "Run Script" scheme action in Xcode 4.2 there is a "Provide build settings from..." drop down menu where you can select a target from which you would like to have the environment variables from. See screenshot below:

Apart from that, if you select "None", there will be a bunch of environment variables set by Xcode. You can discover all of them by doing something like printenv > ~/Desktop/printenv.txt to have them dumped to a text file.

Some of the more useful environment variables include ARCHIVE_PATH, SCHEME_NAME, USER, ARCHIVE_DSYMS_PATH, ARCHIVE_PRODUCTS_PATH.

这篇关于Xcode 4构建方案脚本的设置变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆