There is a "run script only when installing" option in Xcode Run script Build Phase, I am not able to find documentation on this. What does it do?
2 Answers
With Run script only when installing checked, the script only runs when do Product Archive.
4 Comments
Olie
Not when building/installing on a device? (That is:
CMD-B build & run to a physical device (not sim) with the device plugged in. Does that not count as "when installing" for this switch?)seeppp
Debug-installing on a real device (build & run from Xcode) does not count as "installing". The run script only runs when archiving (tested with Xcode 9).
Mobile Ben
Actually this is only partially correct. It depends on the DEPLOYMENT_PROCESSING setting. I'm basing this from running this on Xcode 10. It appears that when you archive, DEPLOYMENT_PROCESSING is set to YES and overrides the setting for the configuration. I've confirmed this through building and seeing the settings in the output since I have "Show environment variables in build log" set to on.
ThomasW
From @Ericg the flag is
DEPLOYMENT_POSTPROCESSING. In looking at the Xcode 14 flags it confirms that is what is used.In the Xcode Build System Guide (Xcode 3.2.x), it says:
Run script only when installing. Runs the script only during install builds, that is, when using the install option of xcodebuild or when the build settings Deployment Location (DEPLOYMENT_LOCATION) and Deployment Postprocessing (DEPLOYMENT_POSTPROCESSING) are on.
5 Comments
ericg
When you need / want to...? I would suggest reading the documentation on DEPLOYMENT_LOCATION, DEPLOYMENT_POSTPROCESSING, & TARGET_BUILD_DIR.
Boon
Read it, but what situations do people use them for?
Wayne
Re: when would you want to use this: I use this flag on scripts that increment the build number, so that it only happens on builds I archive to send out to beta testers (and not every single time I run the app)
seeppp
Or when uploading symbol files to firebase or crashlytics. No need to upload that on every single debug build.
Nike Kov
Actually Fabric tells that symbol files should be uploaded every build. There are better way to configurate the uploading of dSYM. support.crashlytics.com/knowledgebase/articles/…