一、創建spec文件
pod lib create [libName]
二、配置spec文件
[s.name](http://s.name) = 'libName' #名字必須與libname相同
s.version = '1.0.1' #版本必須為0.0.0格式
s.summary = 'all gesture view' #關于庫的一個簡短描述
s.description = <<-DESC
TODO: 備注文字(較長描述)
DESC
#是否支持arc
s.requires_arc = true
#文件主頁
s.homepage = '[https://www.google.com](https://www.google.com)'
#開源協議
s.license = { :type => 'MIT', :file => 'LICENSE' }
#作者信息
s.author = { 'kiyo' => '[xxxxxx@qq.com](mailto:xxxxxx@qq.com)' }
#源文件所在網絡路徑
s.source = { :git => '[https://github.com/xxxx/libName.git](https://github.com/xxxx/libName.git)', :tag => s.version.to_s }
#自定義framework所在路徑
s.vendored_frameworks = 'xxxFrameworks/xxx.framework'
#支持版本
s.ios.deployment_target = '8.0'
#公開頭文件名
s.public_header_files = 'Pod/Classes/**/*.h'
#依賴的系統框架
s.frameworks = 'UIKit', 'MapKit'
#依賴的系統靜態庫
s.libraries = "sqlite3.0"
#依賴的第三方庫
s.dependency 'AFNetworking', '~> 2.3'
#Xcode設置
s.pod_target_xcconfig = { "OTHER_LDFLAGS" => "-ObjC -all_load" }
三、本地驗證spec文件
// 本地驗證
pod lib lint [libName]
// 針對無法正確找到lib.podspec
pod lib lint --source https://github.com/xxxxx/libName.git
// 忽略警告
pod lib lint --allow-warnings
四、提交到遠端倉庫
// cd到lib目錄下
cd [libFolder]
// 由于lib已經在git版本控制下就不需要初始化,直接添加文件提交
git add -A
git commit -s -m "Initial Commit of Library"
// 添加遠端倉庫
git remote add origin [https://github.com/xxxx/libName.git](https://github.com/xxxx/libName.git)
// 提交到遠端倉庫
git push orgin master
五、遠程驗證spec文件
// 遠端驗證
pod spec lint [libName]
六、打上Tag
git tag -m "first commit" "1.0.1"
git push --tags
七、注冊發布自己的Pods(已注冊跳過該步驟)
// 通過郵箱和用戶名注冊
pod trunk register [mail] [mailName] --description='xxx'
- 等到到一份郵件,點擊郵件中的鏈接后驗證是否可以查到自己信息
// 驗證注冊是否成功
pod trunk me
八、發布到cocoapods
// 在工程根目錄(包含有.podspec)
pod trunk push libName.podspec
刪除指定pod版本
pod trunk delete PODNAME VERSION
最后編輯于 :
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。