pod update 和pod install 區(qū)別

Podfile.lock 是在第一次運行 pod install 時生成的


屏幕快照 2019-10-30 下午4.56.18.png

屏幕快照 2019-10-30 下午5.00.54.png

Podfile.lock這個文件是用來鎖定版本的,如果沒有指定版本的話,如下面這種寫法

pod 'AFNetworking' (沒有指定版本)

會有兩種情況:
第一、存在Podfile.lock,則根據(jù)該文件的鎖定版本進行
第二、不存在Podfile.lock,則檢索最新版本

(pod install優(yōu)先遵循 Podfile 里指定的版本信息;其次遵循 Podfile.lock 里指定的版本信息來安裝對應的依賴庫)

但是我想在存在Podfile.lock版本被鎖定的情況下進行更新到最新版本,該怎么做?

查看當前遠程庫里是否有發(fā)布新版本

pod outdated --no-repo-update    (該命令只針對存在新版本的庫)
shoubindeMacBook-Pro:helloWorld shoubintao$ pod outdated --no-repo-update 
Analyzing dependencies
The color indicates what happens when you run `pod update`
<green>  - Will be updated to the newest version
<blue>   - Will be updated, but not to the newest version because of specified version in Podfile
<red>    - Will not be updated because of specified version in Podfile

The following pod updates are available:
- AFNetworking 3.1.0 -> 3.2.1 (latest version 3.2.1)

[!] Automatically assigning platform `iOS` with version `12.2` on target `helloWorld` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

[!] There are duplicate dependencies on `AFNetworking` in `Podfile`:

- AFNetworking
- AFNetworking (~> 3.2.1)

發(fā)現(xiàn)有3.2.1的新版本

pod update --no-repo-update
shoubindeMacBook-Pro:helloWorld shoubintao$ pod update --no-repo-update
Update all pods
Analyzing dependencies
Downloading dependencies
Installing AFNetworking 3.2.1 (was 3.1.0 and source changed to `https://cdn.cocoapods.org/` from `trunk`)
Generating Pods project
Integrating client project
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.

[!] Automatically assigning platform `iOS` with version `12.2` on target `helloWorld` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

使用pod install 的話會被Podfile.lock文件版本鎖定
但是如果使用pod update可以忽略不理睬Podfile.lock文件,直接更新遠程庫中的最新版本

屏幕快照 2019-10-30 下午5.22.18.png
屏幕快照 2019-10-30 下午5.22.40.png

結果已經(jīng)更新到了最新版本3.2.1

?著作權歸作者所有,轉載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

友情鏈接更多精彩內(nèi)容