存档期间不存在 Xcode 环境变量

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14214741/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 02:28:54  来源:igfitidea点击:

Xcode Environment Variables Not Present During Archive

iosxcodeenvironment-variables

提问by miken.mkndev

I have an iOS application that has a TestFlight build scheme. In this scheme I have setup an environment variable called TESTFLIGHT with a value of 1 set in the "Run" tab. Also, in the "Profile" tab of the build scheme it has the "Use the RUn action's arguments and variables" option checked, and I see the appropriate EV in the list.

我有一个具有 TestFlight 构建方案的 iOS 应用程序。在这个方案中,我设置了一个名为 TESTFLIGHT 的环境变量,在“运行”选项卡中设置了值为 1。此外,在构建方案的“配置文件”选项卡中,它选中了“使用运行操作的参数和变量”选项,我在列表中看到了相应的 EV。

This works just fine when running the app from Xcode, but when I make an archive and run the app on my device the Environment Variable TESTFLIGHT is not present. My question is there an option/scheme tab that I'm missing here?

从 Xcode 运行应用程序时,这很好用,但是当我制作存档并在我的设备上运行应用程序时,环境变量 TESTFLIGHT 不存在。我的问题是这里缺少一个选项/方案选项卡吗?

The EV is set on the "Run" tab and is selected for the debug build configuration. Do I need to change this to release?

EV 设置在“运行”选项卡上,并被选择用于调试构建配置。我需要改变这个来发布吗?

Thank you all!

谢谢你们!

回答by Guillaume

Environments variable are set only if you run the app from Xcode. If you run the same app from the device directly by tapping the icon, they won't be set. They are not part of the app. As their name imply, they are part of the environment, that Xcode sets up specifically before running them. (If you were developing on the Mac, you could set them in a shell before launching an executable, but that is not possible on the iPhone.)

仅当您从 Xcode 运行应用程序时才设置环境变量。如果您通过点击图标直接从设备运行相同的应用程序,则不会设置它们。它们不是应用程序的一部分。顾名思义,它们是 Xcode 在运行它们之前专门设置的环境的一部分。(如果你在 Mac 上开发,你可以在启动可执行文件之前在 shell 中设置它们,但在 iPhone 上这是不可能的。)