Under Xcode Target Build Phases, I have a script that enables crashlytics for my iOS app. This is determined by an
ENABLE_CRASHLYTICS
variable and whether it is set or not. I can successfully upload a forced crash when I deploy from my local Xcode to a device so the script is working correctly.
However, when it comes to a build via my Jenkins job, the crashes are not being uploaded. I can see that my Script from the Build phases runs but that the ENABLE_CRASHLYTICS
variable is not set and therefore crashlytics is disabled so no crash reporting from that test build distributed via HockeyApp.
In my Jenkins job at the Build -> Execute Shell step, I do have
ENABLE_CRASHLYTICS=1
Am I missing something else?
Thanks!
The problem is that you are exporting the ENABLE_CRASHLYTICS
environment variable in an "Execute shell" step. Once the shell step has completed, that environment is gone — the variables will not be carried over to subsequent build steps.
So by the time the Xcode build step executes, that particular environment variable is no longer available.
You can also use the EnvInject plugin to inject environment variables during a build. Variables set up using this plugin will be available to all subsequent build steps.