2014年9月20日 星期六

Auto-Build-Count for Xcode 6


自從幾日前提交《AMIGO Controller 2.00》時發現「CFBundleVersion」會被視作應用程式的獨有版本有可能引起在 iTunesConnect 中的錯誤後,我嘗試把自己慣用的「Auto-Build-Count」修改為適合 Xcode 6 之用。只需要簡單的改動便能達到自動生成版本號碼:
buildCount=$(/usr/libexec/PlistBuddy -c "Print 'Build count'" "${PROJECT_DIR}/AMIGOController/AMIGOController-Info.plist")
buildCount=$(($buildCount+1))
/usr/libexec/PlistBuddy -c "Set :'Build count' $buildCount" "${PROJECT_DIR}/AMIGOController/AMIGOController-Info.plist"

appVersion=$(/usr/libexec/PlistBuddy -c "Print 'CFBundleShortVersionString'" "${PROJECT_DIR}/AMIGOController/AMIGOController-Info.plist")
/usr/libexec/PlistBuddy -c "Set :'CFBundleVersion' $appVersion.$buildCount" "${PROJECT_DIR}/AMIGOController/AMIGOController-Info.plist"

沒有留言: