xueshaojie 6d81ef51c9 更新 'XJSDK/0.1.1/XJSDK.podspec' | 2 anni fa | |
---|---|---|
EWENSClass | 5 anni fa | |
EWEllUI_Component | 6 anni fa | |
XJSDK | 2 anni fa | |
README.md | 6 anni fa |
在git仓库服务器创建一个仓库,仓库名 William-Specs (就可以用SVN,没做测试).在本地命令行输入如下命令
pod repo add [Private Repo Name] [GitHub HTTPS clone URL]
pod repo add William-Specs http://132.232.36.81:8443/PrivateCocoapods/William-Specs.git
然后在目录/Users/william/.cocoapods/repos/下回会生成William-Specs目录,这个就是私有库的索引目录,命令行执行pod repo list
会打印 master和William-Specs 两个repos的信息
在git仓库服务器创建一个仓库,仓库名 PodTest.本地命令行输入
pod lib create [PodName]
pod lib create PodTest
创建Pod项目,在PodTest/Classes/目录下添加库文件即.h和.m文件,然后编辑podspec文件.参考这里
验证本地库在所在库根目录下命令行输入pod lib lint
. 验证远程库 pod spec lint
. 当看到 PodTest passed validation
时, 说明验证成功
本地验证通过后把代码 push 到服务器.必须加tag.且tag值和 .podspec 文件中的tag值要匹配
将私有库添加到私有Spec repo 中
pod repo push [私有spec repo] [私有库podspec文件]
pod repo push William-Specs PodTest.podspec
# development 本地测试(即在pod项目example项目中测试本地库)
pod 'PodTest', :path => '../'
# development 服务端测试(即通过本地.podspec文件测试远程库)
#pod 'PodTest', :podspec => '../PodTest.podspec'
#私有Spec Repo 项目中使用(在项目中使用私有仓库的配置方法)
#source 'http://132.232.36.81:8443/PrivateCocoapods/William-Specs.git'
#pod 'PodTest', '~> 0.1.1'
podspec文件配置官方文档
报错内容: in `require': cannot load such file -- colored2 (LoadError)
解决方法: ruby安装 colored2 库
sudo gem install colored2
sudo gem update --system
s.subspec 'JSONKit' do |jsonKit|
jsonKit.requires_arc = false (关键配置项)
jsonKit.source_files = 'PodTest/Classes/jsonKit/**/*'
jsonKit.dependency 'PodTest/Dictionary'
jsonKit.public_header_files = 'PodTest/Classes/jsonKit/**/*.h'
end
两个子库之间引用不能直接引用名字,要引用相对路径名字. 例如: jsonKit.dependency 'PodTest/Dictionary'
引用自己或者第三方的framework或.a文件时,要在podsepc中配置
s.ios.vendored_frameworks = "xxx/**/*.framework"
s.ios.vendored_libraries = "xxx/**/*.a”
在同一个 .h 文件中如果有多个Class声明, 则要配置自定义module_map.例如:
.podspec 中配置
s.module_map = 'EWEllUI_Component/Framework/EWEllUI_Component.modulemap'
自定义module_map
framework module EWEllUI_Component {
umbrella header "EWEllUI_Component.h"
export *
module * { export * }
explicit module EWECycleView {
header "EWEXibVIew.h"
export *
}
explicit module EWERandomColorView {
header "EWEXibVIew.h"
export *
}
}
注意:要将自定义的module_map添加到锁定文件当中。即:
s.preserve_paths = 'README.md','EWEllUI_Component/Framework/EWEllUI_Component.modulemap'