在何处设置应用程序的环境变量?

时间:2022-12-25 22:57:38

I'm working with source code that is frozen and cannot be changed; but its ENV aware and expects changes through the ENV. The source code is being used in an Xcode 4/iOS project.

我使用的源代码是冻结的,不能更改;但它的ENV意识到并期望通过ENV发生变化。源代码正在Xcode 4/iOS项目中使用。

Xcode 3 allowed us to set environmental variables on the app in the Executable folder (see Figure 1 at iOS Debugging Magic). Xcode 4 appears to lack the 'executable info' that was present in Xcode 3.

Xcode 3允许我们在可执行文件夹中设置应用程序的环境变量(见图1,在iOS调试魔术)。Xcode 4似乎缺少Xcode 3中出现的“可执行信息”。

I've looked through a number of similar questions on Stack Overflow, but no one has answered the questions. Answers usually degenerate to preprocessor macros. Confer: How to set environment variables in iPhone executable using XCode 4?, Conditional Environment Variables in Xcode, and Where to set environmental variables in ios?.

我查阅了大量关于Stack Overflow的类似问题,但是没有人回答这些问题。答案通常退化为预处理器宏。Confer:如何使用XCode 4在iPhone可执行文件中设置环境变量?, Xcode中的条件环境变量,ios中的环境变量设置在哪里?

How does on set an app's environment variables in Xcode 4?

如何在Xcode 4中设置应用程序的环境变量?

1 个解决方案

#1


54  

You can set environment variables via Xcode Schemes. To edit a scheme, select it in the top bar:

您可以通过Xcode方案设置环境变量。要编辑一个方案,请在顶部栏中选择:

在何处设置应用程序的环境变量?

Choose the Run mode and go to the Arguments tab, and there you go...

选择Run模式,进入Arguments选项卡,就这样……

在何处设置应用程序的环境变量?

By default, these settings are also used for the Test and Profile modes.

默认情况下,这些设置也用于测试和概要模式。

#1


54  

You can set environment variables via Xcode Schemes. To edit a scheme, select it in the top bar:

您可以通过Xcode方案设置环境变量。要编辑一个方案,请在顶部栏中选择:

在何处设置应用程序的环境变量?

Choose the Run mode and go to the Arguments tab, and there you go...

选择Run模式,进入Arguments选项卡,就这样……

在何处设置应用程序的环境变量?

By default, these settings are also used for the Test and Profile modes.

默认情况下,这些设置也用于测试和概要模式。