The Podfile (Podfile 的写法和规范)
生活随笔
收集整理的這篇文章主要介紹了
The Podfile (Podfile 的写法和规范)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Podfile 的寫法和規范
一個簡單的 Podfile 事例,將 Alamofire 添加的單個項目中:
target 'MyApp' douse_frameworks!pod 'Alamofire', '~> 3.0' end可在 Podfile 的文件的最上方添加依賴庫的來源地址
source 'https://github.com/CocoaPods/Specs.git' // CocoaPods 的依賴庫地址 source 'https://mirrors.bfsu.edu.cn/git/CocoaPods/Specs.git' // 北京外國語大學開源軟件鏡像站依賴庫地址?指定 Pod 的版本
新項目開始,你可能會使用 Pod 的最新版本。這種情況下可省略版本要求。
pod 'Alamofire'在項目開始后,可能會需要凍結到 Pod 的特定版本。這種情況下你可以指定該版本號。
pod 'Alamofire', '5.0.0'除了沒有版本或是特定版本以為,還可以使用邏輯運算符:
- '> 0.1'?任何高于0.1的版本
- '>= 0.1'?0.1版及更高版本
- '< 0.1'?任何低于0.1的版本
- '<= 0.1'?0.1版及更低版本
除邏輯運算符外,CocoaPods還具有樂觀運算符~>:
- '~> 0.1.2'?版本0.1.2和不超過0.2的版本,不包括0.2和更高版本
- '~> 0.1'?版本0.1和不超過1.0的版本,不包括1.0和更高版本
- '~> 0'?版本0和不超過1.0的版本,不包括1.0和更高版本
使用本地的Pod文件,可以使用 :path
pod 'Alamofire', :path => '~/Documents/Alamofire'如果想使用 Pod 的最新版本 podspec,特定版本或自己的 fork。這種情況可以在 Pod 聲明中指定。
要使用 master 倉庫的分支:
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git'要使用倉庫的另一個分支:
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :branch => 'dev'要使用倉庫的標簽:
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :tag => '3.1.1'或指定一個提交:
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :commit => '0f506b1c45'如果一個podspec能夠從外部的倉庫源的獲取,設想一下,也通過HTTP來獲取podspec:?
pod 'JSONKit', :podspec => 'https://example.com/JSONKit.podspec'更多內容請查看:Podfile Syntax Reference?v1.9.3?
?
?
?
總結
以上是生活随笔為你收集整理的The Podfile (Podfile 的写法和规范)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: csm redfish usb
- 下一篇: 【android】关于android10