pod help-->檢視pod命令的幫助
pod search --> Search for pods(搜尋pod)
pod trunk --> Interact with the CocoaPods API (e.g. publishing new specs) 上傳source到trunk
pod spec --> Manage pod specs//管理pod spec
pod install -->Install project dependencies according to versions from a Podfile.lock //安裝專案中的依賴專案
pod update -->Update outdated project dependencies and create new Podfile.lock//跟新依賴專案並且更新Podfile.lock
pod init -->Generate a Podfile for the current directory//建立pod file檔案
複製程式碼
//注GKFramework.podspec是你的框架名稱
pod spec create GKFramework.podspec
複製程式碼
然後編輯podspec檔案。如下GKFramework.podspec
Pod::Spec.new do |s|
s.name = "GKFramework" //定義名稱
s.version = "0.0.5" //tag版本
s.summary = "A Sample.so you can use it" //簡介,以後search到簡介
s.description = <<-DESC
this is gk framework, use it fortest your framework. we can use it as framework.
DESC
//s.description 定義具體的描述
s.homepage = "https://github.com/wongstar/GKFramework"
s.license = { :type => "MIT", :file => "LICENSE" }//具體license
s.author = { "wongstar" => "wongstar.iac@gmail.com" }
s.platform = :ios, "8.0"//build的平臺
s.ios.deployment_target = "7.0"//最低開發
s.source = { :git => "https://github.com/wongstar/GKFramework.git", :tag => "#{s.version}" }
s.source_files = 'Classes/**/*'#s.public_header_files='GKFramework/Classes/**/*.h'
end
複製程式碼
s.description = <<-DESC
this is gk framework, use it fortest your framework. we can use it as framework.
DESC
s.description定義了描述該pod是用來做什麼的。注意這裡的寫法
複製程式碼
Swift 版本問題
[!] The validator for Swift projects uses Swift 3.0 by default, if you are using a different version of swift you can use a .swift-version file to set the version for your Pod. For example to use Swift 2.3, run:
echo"2.3" > .swift-version.
複製程式碼
驗證失敗,會出現一系列錯誤,但也不是無根可尋,其中出現錯誤頻率最多的提示是
source files沒找到
ERROR | [iOS] file patterns: The source_files pattern did not match any file.
pod search GKFramework 搜尋不到
Unable to find a pod with name, author, summary, or description matching GKFramework.
解決辦法:
1.pod install --repo-update
2.或者全部刪除:使用命令:rm ~/Library/Caches/CocoaPods/search_index.json
重新search GKFramework