I have an app with 3 targets:
- app target
- message app
- app extension
I'm trying to update the build number for each build, this number must be equal for all the target or App Store will invalid the build.
I've tried different approach, also this one, but I don't like it because I must hardcode the plist file names into the script, while I would prefer to keep it as general as possible.
Searching for different solutions, I've found this tool from Apple called avgtool.
I was able to create a script that updates the build number at the same value for all the target, but this seems to work only if I add it to the build phases at the top of the list. The issue is that this script must be launched before building.
In order to do that it must be added to the Edit Scheme->Build->Pre-Actions
but when I write it here it doesn't have any effect.
#!/bin/bash
buildNumber=$(date +%s)
echo "$buildNumber"
xcrun agvtool new-version -all "$buildNumber"