ios 在哪里设置应用程序的环境变量?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17393053/
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-08-31 00:09:11  来源:igfitidea点击:

Where to set environment variables for app?

iosxcode4environment-variablesxcode4.6

提问by jww

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 允许我们在 Executable 文件夹中的应用程序上设置环境变量(参见iOS Debugging Magic 中的图 1 )。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 上浏览了许多类似的问题,但没有人回答这些问题。答案通常退化为预处理器宏。授予:如何使用 XCode 4 在 iPhone 可执行文件中设置环境变量?, Xcode 中的条件环境变量,以及ios 中在哪里设置环境变量?。

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

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

回答by hagi

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

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

Editing a scheme in Xcode

在 Xcode 中编辑方案

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

选择 Run 模式并转到 Arguments 选项卡,然后就可以了...

Setting environment variables in Xcode

在 Xcode 中设置环境变量

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

默认情况下,这些设置也用于测试和配置文件模式。