Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to set environment variables for app?

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.

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.

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?.

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

like image 491
jww Avatar asked Jun 30 '13 17:06

jww


People also ask

How do I set an environment variable in an application?

In the Settings window, under Related Settings, click Advanced system settings. On the Advanced tab, click Environment Variables. Click New to create a new environment variable. Click Edit to modify an existing environment variable.

How do I set an environment variable in Powerapps?

Create an environment variable in a solution. Sign in to Power Apps (make.powerapps.com), and then on the left pane select Solutions. Open the solution you want or create a new one. On the command bar, select New > More, and then select Environment variable.

How do I know where my environment variable is set?

Select Start > All Programs > Accessories > Command Prompt. 2. In the command window that opens, enter echo %VARIABLE%. Replace VARIABLE with the name of the environment variable you set earlier.


1 Answers

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

Editing a scheme in Xcode

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

Setting environment variables in Xcode

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

like image 189
hagi Avatar answered Sep 21 '22 21:09

hagi