403
社区成员




pod引用库的原理,本质上是去找.podspec
文件,podspec中包含库的地址及最新的版本号(tag标签),如果pod时没有指定版本,则pod install时会去下载podspec文件中指定的最新版本,如果pod时指定了版本规则,则pod install会按照此版本规则去下载指定的版本
例如想引用RZPayManager
这个库,有三种方法:
pod 'RZPayManager' //引用该库的最新版本
pod 'RZPayManager', '~>0.1.0' //引用该库的0.1.x版本(x可为>=0的任意值)
这种写法pod install
时会默认到本地的pod repo
中去找podspec
文件,如果找不到的话有两种可能,一种是此第三方库根本不存在,另一种是本地的pod repo
没有更新到最新版,需要执行一下pod repo update
来更新到最新版
pod 'RZPayManager', :git => 'https://github.com/ReyZhang/RZPayManager.git'
pod 'RZPayManager', :git => 'https://github.com/ReyZhang/RZPayManager.git', tag=>'0.1.0'
这种写法pod install
时会从指定的git地址
中去找podspec
文件,此例中会去 https://github.com/ReyZhang/RZPayManager.git
这个地址中去找
pod 'RZPayManager', :path => '../'
这种写法pod install
时会从指定的本地目录
中去找podspec
文件