Is there some way in Xcode to somehow add 1 to a build number of my app each time i click build? Possibly a plugin that adds 1 to a text file containing the number inside my project?
http://lists.apple.com/archives/xcode-users/2004/Jan/msg00596.html
here is a site that seems to be doing what i’m trying to do, but i get a build error every time on the shell script step.
i can’t find any other information on this for some reason. anybody? please?[/url]
The following works for me in Xcode 1.5. Save this script:
as an uncompiled AppleScript text file named “increment_build_version.applescript” and place it in the root level of your project folder. Then, in the project itself, go to the Project menu and select “New Build Phase > New Shell Script Build Phase”. This will add a new item to your target. Select the new “Shell Script Files” item in the target group and type Command-I to get its info. In the info window, leave the Shell field set to “/bin/sh” and in the Script field, enter this:
osascript “$SRCROOT/increment_build_version.applescript”
Now build your project and the version number should be incremented. Note, this is different than the CFBundleShortVersionString or CFBundleGetInfoString strings visible in the Finder that you set in the InfoPlist.strings file. This is the number that is displayed in parentheses when you show the standard about box in the application itself.
Jon
[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]
Works perfectly! This is about the millionth time you’ve saved me on something. Thanks!
In Xcode v2.0, Apple has completely changed the scripting dictionary and “product settings” is no longer a property of a target (this property doesn’t exist at all for any element, actually, though it is eluded to in the description of a target). Also, “current target” has been replaced with “active target”. With these changes, you can’t use the script above to increment the build number. This script, however, using the “defaults” command line tool, should work:
Still follow the same steps outlined above to actually add it a new Shell Script Build Phase.
One caveat to the above: this may change your plist from normal XML text to a binary file. It may look funny in Xcode (or in any text editor) but the system will know how to process it. Opening it in the Property List Editor app should show it to be fine. If you want to convert it back to XML from the binary file, add this line after the “defaults write” line:
Jon
[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]