How to auto increment the build number in Xcode 5 [duplicate]

Deadly 提交于 2020-01-11 14:49:08

问题


I was wondering if Xcode 5 is providing a setting to automatically count up the Build number found under General in the Identity section of the project navigator.

But afaik you still have to do it with scripting, using PlistBuddy.

One simple solution is to increase the build number in Xcode 5 is posted below:


回答1:


Go to Editor -> Add Build Phase -> Add Run Script Build Phase

Go to Build Phases in the project navigator and edit Run Sript. Change Shell to /bin/bash and paste the following script:

#!/bin/bash
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_FILE"

Don't forget to change the Build number found under General in the Identity section from 1.0 to 1

Have fun! :)

I found this tutorial on Cocoa Factory



来源:https://stackoverflow.com/questions/21114376/how-to-auto-increment-the-build-number-in-xcode-5

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!