0

In my project there is a variable(Int) value that I want to be different for development and Ad-Hoc/Production because it's hard to test app with large number(100) for that value, so I changed it to 3 to test but now problem is that I have to build app frequently and some time I forgot to change the value back to 100 so is there any way to make this process automated ?

Varun Naharia
  • 5,318
  • 10
  • 50
  • 84
  • Possible duplicate of https://stackoverflow.com/q/38813906/2227743 (use `#IF DEBUG`) – Eric Aya Oct 13 '17 at 12:34
  • @Moritz yes it's smiler to what I am asking here and I can use answer from that question (Actually i am using it that answer as an alternative for now) but what I am asking here is that make variable value selection automated for Development/AdHoc eg. if app installing from cable variable value should 3 and if app is installing from Ad-Hoc build Via Diawi then value should be 100, Is that possible ? – Varun Naharia Oct 25 '17 at 06:03

1 Answers1

-2

Use different build configurations as described here: http://limlab.io/swift/2016/02/22/xcode-working-with-multiple-environments.html

Targets are usually used for different apps sharing the same code base. For example: Lite and Pro versions of an application or Watch extension etc.

Update:

https://developer.apple.com/library/content/featuredarticles/XcodeConcepts/Concept-Targets.html

A target specifies a product to build and contains the instructions for building the product from a set of files in a project or workspace.

As I already mentioned, targets are usually used for different products which behave different. In your case you duplicate build setting, phases etc. for a single variable you want to be different.

https://developer.apple.com/library/content/featuredarticles/XcodeConcepts/Concept-Build_Settings.html

A build setting is a variable that contains information about how a particular aspect of a product’s build process should be performed.

It is quite enough to manage "different environments" for a single target in order to achieve what you want.

Andrey Gershengoren
  • 896
  • 1
  • 5
  • 18