CocoaPod 私有庫 Spec 編輯注意事項#
CocoaPod 私有庫 Spec 依賴.a 寫法
PodSpec 詳細描述如下,
Pod::Spec.new do |s|
# 庫名稱
s.name = 'AudioRecorder'
# 庫的版本
s.version = '0.1.0'
# 庫摘要
s.summary = 'AudioRecorder提供iOS錄音和錄音播放功能'
# 庫描述
s.description = <<-DESC
AudioRecorder提供iOS錄音和錄音播放功能
DESC
# 遠程倉庫地址
s.homepage = 'https://github.com/xxx'
# 截圖
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
# MIT許可證,軟體授權條款
s.license = { :type => 'MIT', :file => 'LICENSE' }
# 作者資訊
s.author = { 'MorganWang' => '[email protected]' }
# 支持的系統及支持的最低系統版本
# s.platform = :ios
# s.platform = :ios, "8.0"
# 支持多個平台使用時
s.ios.deployment_target = "10.0"
# s.osx.deployment_target = "10.7"
# s.watchos.deployment_target = "2.0"
# s.tvos.deployment_target = "9.0"
# 下載地址
s.source = { :git => 'xxx.git', :tag => s.version.to_s }
# 庫文件在倉庫中的相對路徑
# 等號後面的第一個參數表示的是要添加 CocoaPods 依賴的庫在項目中的相對路徑
# 等號後面的第二個參數,用來指示文件夾下的哪些文件需要添加 CocoaPods 依賴
# “**”通配符表示文件夾下的所有文件,“*.{h,m}”代表所有的.h, .m文件
s.source_files = 'AudioRecorder/Classes/**/*'
# 設置不需要添加到 CocoaPods 的文件
# s.exclude_files = "xxx/Exclude"
# https://blog.csdn.net/w_shuiping/article/details/80606277
# CocoaPods中依賴的第三方.a或者.framework庫
s.vendored_libraries = 'AudioRecorder/Classes/lame/*.a'
# s.resource_bundles = {
# 'AudioRecorder' => ['AudioRecorder/Assets/*.png']
# }
# s.public_header_files = 'Pod/Classes/**/*.h'
# 庫中用到的框架或系統庫
s.frameworks = 'UIKit', 'Foundation', 'AVFoundation'
# 庫中依賴的其他CocoaPods的第三方庫,依賴多個寫多個s.dependency
s.dependency 'Masonry', '~> 1.1.0'
end
庫校驗
pod lib lint --allow-warnings
使用#
使用 tag 或者使用分支,通常使用 tag,因為 tag 代表功能的完整性。如果使用分支,隨後在分支上繼續開發,然後再次 update 依賴時,可能會出現新開發的內容未驗證就被更新了或者不兼容的情況
pod 'xxx',:git=>'xxx.git',:tag=>'0.7.0'
pod 'yyy',:git =>'yyy.git',:branch=> 'develop'