cocoapods 上传私有库或者远程库遇见的问题汇总
一、本地验证报错 $ pod lib lint
localhost:XTBMain liuyihua$ pod lib lint
-> XTBMain (0.1.3)
- ERROR | [iOS] unknown: Encountered an unknown error (Unable to find a specification for `XTBBaseLib/Category` depended upon by `XTBMain`) during validation.
[!] XTBMain did not pass validation, due to 1 error.
[!] The validator for Swift projects uses Swift 3.0 by default, if you are using a different version of swift you can use a `.swift-version` file to set the version for your Pod. For example to use Swift 2.3, run:
`echo "2.3" > .swift-version`.
You can use the `--no-clean` option to inspect any issue.
localhost:XTBMain liuyihua$
根据提示信息,我们了解到主要是因为
私有库的 'XTBBaseLib/Category '找不到
假如你已经创建好私有库A,并想在私有库B中使用私有库A,在库B的.podspec文件中你需要制定依赖:
s.dependency 'pod projectName(A)', '~> version'
校验sepc可用性时,执行以下命令:
pod sepc lint 文件名.podspec
发生错误:
- ERROR | [iOS] unknown: Encountered an unknown error (Unable to find a specification for XTBBaseLib/Category depended upon by XTBMain) during validation.
原因:
校验podspec文件时会到远程podspec库查找相关依赖,默认只会到官方specs库校验,此时需要指定远程specs库去校验。
解放方案:
localhost:XTBMain liuyihua$ pod spec lint 文件名.podspec --sources='http://[privateLibName]/cocoaspecs.git,https://github.com/CocoaPods/Specs.git'
-> XTBMain (0.1.3)
XTBMain passed validation.
localhost:XTBMain liuyihua$






网友评论