Can't figure out how to populate CFBundleVersion dynamically with ${BUNDLE_VERSION} which I would like to define as
BUNDLE_VERSION=`date "+%y%m%d"`
Anyone?
Can't figure out how to populate CFBundleVersion dynamically with ${BUNDLE_VERSION} which I would like to define as
BUNDLE_VERSION=`date "+%y%m%d"`
Anyone?
You’ll need an Xcode configuration file and a configuration variable that you set at build time. This is described in some detail at Diego Massanti’s blog. You’ll need to modify the build phase he describes to set the variable to the current date instead of incrementing the existing value.
If you're doing command-line builds with xcodebuild, you can do something like
xcodebuild -target MyApp -configuration AppStore BUNDLE_VERSION=`date "+%y%m%d"`
However, I advise against doing this. An App Store app has three versions:
I think they're all supposed to be of the form [0-9]+.[0-9]+(.[0-9]+)?
. To avoid confusion, I set them all to the same thing for App Store builds (we include CFBundleVersion/CFBundleShortVersionString in bug reports, and it's nice if they match CFBundleVersion). Non-App Store builds can include more info, since they don't need to be submitted.
I don't know if iTunes Connect lets you submit an app with CFBundleVersion that doesn't contain a ".", but I haven't extensively tested this.