For some years now I’ve used the next ‘Run Script’ in Xcode to take care of a construct counter in Information.plist for reference inside my code:
#!/bin/bash
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_FILE"
In Swift I can entry this with let bld = Bundle.primary.infoDictionary?["CFBundleVersion"]
, which I wish to maintain doing.
Just lately Xcode 15 recommended I replace undertaking settings with ENABLE_USER_SCRIPT_SANDBOXING = YES;
, which led to the error PhaseScriptExecution failed with a nonzero exit code
linking to a difficulty in Information.plist till I understood so as to add Information.plist as an each an enter and output file for the Run Script.
Now I’ve an error Cycle inside <myProject>; constructing may produce unreliable outcomes. This often will be resolved by transferring the shell script part 'Run Script' in order that it runs earlier than the construct part that depends upon its outputs.
Specifically this complains that Photographs.xcassets
depends upon (apparently) Information.plist.
The ‘Run Script’ construct part already runs first (as excessive as I can drag it within the ‘Construct Phases’ listing). Clearly I can ignore the brand new default setting for ENABLE_USER_SCRIPT_SANDBOXING and miss the Enter/Output file settings, however it could be good to seek out the correct method to do that so all the things is glad and safe. Photographs.xcassets is an Apple/Xcode factor which is opaque to me.
Recommendations / options a lot appreciated.