开发者

How to populate Info.plist values dynamically in Xcode?

Can't figure out how to populate CFBundleVersion dynamically with 开发者_Python百科${BUNDLE_VERSION} which I would like to define as

BUNDLE_VERSION=`date "+%y%m%d"`


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:

  • The iTunes Connect version number (this is the only one normally shown to the user)
  • CFBundleVersion
  • CFBundleShortVersionString

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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜