The version string must be in the format [xx]. [yy]. [zz] where x, y, z are numbers.
I deal with this using git tag to give specific commits of meaningful tag numbers for x and y (e.g. 0.4), and then through the build phase of script z gets the number of commits since the last tag since git describe returned.
Here is the script that I adapted from this one . It can be added directly to the target as a build phase ( shell is /usr/bin/env ruby ):
# add git tag + version number to Info.plist version = `/usr/bin/env git describe`.chomp puts "raw version "+version version_fancy_re = /(\d*\.\d*)-?(\d*)-?/ version =~ version_fancy_re commit_num = $2 if ( $2.empty? ) commit_num = "0" end fancy_version = ""+$1+"."+commit_num puts "compatible: "+fancy_version # backup source_plist_path = File.join(ENV['PROJECT_DIR'], ENV['INFOPLIST_FILE']) orig_plist = File.open( source_plist_path, "r").read; File.open( source_plist_path+".bak", "w") { |file| file.write(orig_plist) } # put in CFBundleVersion key version_re = /([\t ]+<key>CFBundleVersion<\/key>\n[\t ]+<string>).*?(<\/string>)/ orig_plist =~ version_re bundle_version_string = $1 + fancy_version + $2 orig_plist.gsub!(version_re, bundle_version_string) # put in CFBundleShortVersionString key version_re = /([\t ]+<key>CFBundleShortVersionString<\/key>\n[\t ]+<string>).*?(<\/string>)/ orig_plist =~ version_re bundle_version_string = $1 + fancy_version + $2 orig_plist.gsub!(version_re, bundle_version_string) # write File.open(source_plist_path, "w") { |file| file.write(orig_plist) } puts "Set version string to '#{fancy_version}'"
source share