How to auto-increment Bundle Version in Xcode 4?

后端 未结 9 888
情书的邮戳
情书的邮戳 2020-12-12 16:43

I am trying to figure out how to have the Bundle version number increment automatically in my Xcode 4 project (for ad-hoc and release builds). I found some scripts online th

9条回答
  •  一整个雨季
    2020-12-12 16:55

    FWIW - this is what I'm currently using to increase the build number only for release builds (which includes archiving). Works fine under Xcode 5.1.

    Just copy/paste the snippet into a Run script build phase directly in Xcode:

    buildnum=$(/usr/libexec/PlistBuddy -c "Print :CFBundleVersion" "$PRODUCT_SETTINGS_PATH")
    
    if [ "$CONFIGURATION" = "Release" ]; then
    buildnum=$((buildnum + 1))
    echo "Build number updated to $buildnum"
    /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildnum" "$PRODUCT_SETTINGS_PATH"
    fi;
    

提交回复
热议问题