关于XCode 的agvtool命令行

简介:用agvtool如何来自动更新版本号和bulid version
 
agvtool是一个命令行工具,允许你自动递增到下一个最高的数量或具体的数字这些数字。本文档提供了更新您的构建和版本号码使用agvtool一步一步的指示。
“Xcode”和“命令行”部分显示是在Xcode中分别执行的步骤和命令行。
 
Important: When your app includes multiple targets, agvtool will set the version numbers of all your targets to the same number.
 

Xcode:

你必须完成你的在Xcode项目中的设置步骤。

导航到您的目标的生成设置窗格,然后为您的生成配置进行更新,如下所示:

1.修改Xcode的默认设置

默认情况下,在不使用任何版本控制系统。设置版本系统苹果通用确保Xcode将包括在你的项目中生成的所有agvtool版本信息。

图1:设置当前项目的版本和版本控制系统的构建设置

 2.设置你的版本号和bulid版本号 Set up your version and build numbers.

   这个需要你手动添加几个项,来图看看

agvtool查询应用程序的Info.plist得到你的版本和bulid版本号。它更新他们,如果他们存在,不做任何事,

否则。确保 CFBundleVersion (Bundle version)和CFBundleShortVersionString (Bundle versions string, short)的key在你的Info.plist中

如图2所示。 info.plist显示

 

3.接下来是命令行操作,来更新版本号

退出Xcode,然后导航到包含项目的目录,运行下列命令在终端应用agvtool属性工作。

   3.1 打开终端 ,cd 工程直接路径 例如工程名为xxx 则cd   /Users/itdept/Desktop/practice/xxx
   3.2 更新版本号 到2.0 则输入命令:$xcrun agvtool new-marketing-version 2.0
 
4.更新Build Number
  4.1 自动增加你的Build Number 执行的命令:$xcrun agvtool next-version -all
  4.2 给你的应用程序设置一个Build number,执行的命令是 $xcrun agvtool new-version -all 2.6.9
5.查看Version Numbers
  5.1查看当前的Version Number 执行:$xcrun agvtool what-marketing-version
  5.2 查看当前的Build Number 执行:$xcrun agvtool what-version
原文地址:https://www.cnblogs.com/ZGSmile/p/5843019.html