Increase build num
2019-05-24 本文已影响0人
Albert新荣
1.TARGETS -> [your project] -> Build Phases -> +
2.Select New Run Script Phase
3.Copy this entire script in the provided blank space.
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/${INFOPLIST_FILE}"
4.Check the Run script only when installing item. If you want this script to increment build number only while archiving project.
5.Uncheck the Run script only when installing item. If you want to increment build number every time you run the project.