pod私有库创建详细教程
pod私有库搭建完成后,给私有库创建子模块如图的形式

supspecs.png
一、修改文件夹结构

文件夹

文件夹结构
二、上传改动到远程代码仓库
$ git add .
$ git commit -m "文件夹结构调整"
$ git push -u origin master
//tag 值增加
$ git tag 0.1.1
//推送tag到服务器上
$ git push --tags
三、修改.podspec

子模块
终端输入pod spec lint校验 spec

通过
四、提交spec
pod repo push TestLib TestLib.podspec --sources=http://git.weiyankeji.cn/yuehuig/TestSpec.git
五、项目中使用pod库
三种用法
-
pod 'TestLib'引入pod库中所有模块 -
pod 'TestLib/GTimer'只引入GTimer模块 pod 'TestLib', :subspecs => ['Extension', 'GTimer']

使用pod库
安装即可
六、子模块中依赖三方库
添加dependency

添加依赖库
执行pod spec lint 会报警告

报错
[!] The spec did not pass validation, due to 1 warning (but you can use `--allow-warnings` to ignore it).
命令加参数--allow-warnings

成功
然后推送spec到远程、指令也需加上--allow-warnings
此时仍报错
ERROR | [iOS] unknown: Encountered an unknown error (Unable to find a specification for

报错
因为依赖的三方库是官方pod库中的,添加上源

成功
七、子模块依赖静态库

依赖静态库
执行检测pod spec lint --allow-warnings报错
- ERROR | [iOS] unknown: Encountered an unknown error (The 'Pods-App' target has transitive dependencies that include static binaries:

报错
这个错误是因为依赖库s.dependency包含了.a静态库造成的。虽然这并不影响Pod的使用,但是验证是无法通过的。可以通过 --use-libraries 来让验证通过。
pod install报错
[!] The 'Pods-OCTestLib_Example' target has transitive dependencies that include static binaries: (/Users/yuehuig/OCTestLib/Example/Pods/GTSDK/GTSDK.framework)
尝试在podspec中加入
s.static_framework = true
不行的话,换第二种方法 在podfile中加入
pre_install do |installer|
# workaround for #3289
Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
end