网上说,pod install
会按照 pod 文件指定的版本安装,而pod update
会安装最新版本,那么问题来了。
举个例子:
//使用大于等于0.1.2,小于0.2的版本
pod ‘AFNetworking’, ‘~>0.1.2′
如果我现在的版本是0.1.2,最新版本是1.1.0,中间还有一个版本是0.1.9,那么pod install
是哪个版本,pod update
是哪个版本?
迷茫2017-04-18 09:41:16
The following takes version 1.1.0.rc.2 as an example for explanation.
You can view the installed version via pod env
.
CocoaPods : 1.1.0.rc.2
Ruby : ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
RubyGems : 2.5.1
Host : Mac OS X 10.11.6 (15G1004)
Xcode : 8.0 (8A218a)
Git : git version 2.8.4 (Apple Git-73)
Ruby lib dir : /usr/local/Cellar/ruby/2.3.1/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ 02982fffbac5c3b22e7b0c2a77515f865f0e1065
Executable Path: /usr/local/bin/pod
cocoapods-deintegrate : 1.0.1
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-stats : 1.0.0
cocoapods-trunk : 1.0.0
cocoapods-try : 1.1.0
Take pod ‘AFNetworking’, ‘~>0.1.2′
as an example
pod install
首先会检查 Podfile.lock
文件。如果里面的版本号符合该要求,0.1.x
,比如是 0.1.3
,则会按照指定的版本号进行安装。如果不符合,比如指定了 0.2.9
,则会安装 0.1.9
.
pod update
会忽略 Podfile.lock
文件。直接分析 Podfile
file to install.
PHP中文网2017-04-18 09:41:16
pod install, if it has not been installed before, the latest version of the restriction will be installed; if it has been installed, it will be the previously installed version.
pod update, the latest version of the restriction is installed.