Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Environment variables and arguments passed on launch are not working once I compile the app

Tags:

xcode

ios

swift

The thing is that I set some defaults before I run the app under specific target:

enter image description here

This is how I check if my target runs or not:

if NSProcessInfo.processInfo().arguments.contains("DIFF") {}

or

if NSProcessInfo.processInfo().environment["DIFF"] != nil {}

but they works only after I compile the app on device. Once I close the app, and run again from the icon app on device, it doesnt work anymore. Why?

like image 446
Bartłomiej Semańczyk Avatar asked Feb 18 '16 22:02

Bartłomiej Semańczyk


1 Answers

Those arguments are only passed to the app when it is launched by Xcode using your scheme. When the app is launched by the user tapping the the icon, the arguments will not be passed.

like image 69
Craig Siemens Avatar answered Sep 24 '22 17:09

Craig Siemens