I have tried a few things, but I can't get the variables to stick, probably because I am not used to writing Scripts.
The documentation from Appcenter : https://learn.microsoft.com/en-us/appcenter/build/custom/variables/ It says I can only access the environment variables from app center in the build script..
I have tried creating a Run Script from Build phases, but no variables is saved no matter what. How do I save an environment variable ? I have tried, export ENVIRONMENT_TEST="abc", but I cant see it afterwards using
let environments = ProcessInfo.processInfo.environment["ENVIRONMENT_TEST"]
I found a similar issue: Using Microsoft App Center environment variables in iOS
here the solution is to save the environment variable $ENVIRONMENT_VARIBLE to a file and read from it later. So now im trying to save to a new plist file. This works locally, but not from a device. I believe its because the path is different. I use:
plutil -replace somekey -string somevalue1 ${SOURCE_ROOT}/AppName/AppcenterValues.plist
Any ideas for this ?
the predefined variables are different, instead of SOURCE_ROOT
use APPCENTER_SOURCE_DIRECTORY
. You script will end up something like this:
plutil -replace somekey -string somevalue1 $APPCENTER_SOURCE_DIRECTORY/AppName/AppcenterValues.plist
You can find more examples on the official AppCenter
github repository in following link: