1. POD庫的創(chuàng)建
首先創(chuàng)建本地的文件,cd 到這個文件下
pod lib create xxx
//這里xxx是pod的name,自己取名
除了第一個是yes,其他都選擇no,這里會創(chuàng)建模板
- 打開模板,在pods -> Development Pods 里面的名稱目錄拖進去,可以和class同級目錄,這里主要對象是framework,如果是具體的實現文件,建議放到classes里面
了解: https://www.cnblogs.com/ALongWay/p/6541289.html
了解: https://guides.cocoapods.org/syntax/podspec.html#watchos
#
# Be sure to run `pod lib lint ToolTest1.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
#這里是搜索POD的名稱
s.name = 'ToolTest1'
#這里是版本號,通過這個版本在搜索下面的tag,所以版本和tag不要相同,每次都要修改這里
s.version = '0.0.2'
#概述,這里必須要修改
s.summary = 'create by jixiao as Test'
# This description is used to generate tags and improve search results.
# * Think: What does it do? Why did you write it? What is the focus?
# * Try to keep it short, snappy and to the point.
# * Write the description between the DESC delimiters below.
# * Finally, don't worry about the indent, CocoaPods strips it!
#具體的描述 todo 后面的內容 必須比summary長
s.description = <<-DESC
TODO: create by jixiao as Test.Just For Funssssssss.
DESC
#主頁地址,必須要修改!!,不修改通不過
s.homepage = 'https://www.baidu.com'
#默認的MIT好像是一種證書
s.license = { :type => 'MIT', :file => 'LICENSE' }
#創(chuàng)建的時候自動生成了
s.author = { 'jixiao' => 'jixiao@otctop.com' }
#來源地址,本地創(chuàng)建的地址,tag就是后面要打的tag
s.source = { :git => 'git@10.0.50.71:/home/git/zzjs.git', :tag => s.name.to_s+'v'+s.version.to_s }
#支持的版本
s.ios.deployment_target = '8.0'
s.requires_arc = true
#重要,將需要打包的framework附上,用”,”分割,或者用或者用 "*.framework"
s.ios.vendored_frameworks = 'ToolTest1/HomeFramework.framework'
# 引用自己生成的.a文件
# s.ios.vendored_libraries = 'Pod/Assets/*.a'
#重要,第三方依賴庫,如果有依賴在這里添加,如果多個需要填寫多個s.dependency
s.dependency 'AFNetworking', '~> 3.1.0'
#所需的framework,多個用逗號隔開
s.frameworks = 'UIKit',
# 引用靜態(tài)庫:’(.ios).library’,去掉頭尾的lib,引用libxml2.lib和libz.lib.
# s.libraries = 'xml2', 'z'
# 載入bandle
s.resources = "TGRefreshOC/TGRefreshOC/TGRefreshOC/TGRefreshOC.bundle"
# s.resources = ["Images/*.png", "Sounds/*"]
# s.resource_bundles = {
# 'MyLibrary' => ['Resources/*.png'],
# 'OtherResources' => ['OtherResources/*.png']
# 關于引入module 需要下面的話,沒有測試過
s.preserve_path = 'module/module.modulemap'
s.module_map = 'module/module.modulemap'
s.pod_target_xcconfig = { 'HEADER_SEARCH_PATHS' => '$(PODS_ROOT)/mypod/module' }
s.xcconfig = { 'HEADER_SEARCH_PATHS' => '$(SDKROOT)/usr/include/libxml2 $(PODS_ROOT)/mypod/module' }
}
end
2. podspec 上傳到私有倉庫
- cd 到含有podspec的文件下
- 編輯podspec ,具體看上面部分
- 編輯完成pod lib lint/pod spec lint --sources='私有倉庫repo地址,https://github.com/CocoaPods/Specs' --use-libraries 檢查是否能通過
- 檢查完成git add -A && git commit -m "這是comence信息"
- git tag '[Pod的名字]v0.0.1'
- git remote add 倉庫名 倉庫地址
- git push 倉庫名 --tags
- pod repo push 倉庫名 NAME.podspec