GitHub组件库创建和使用就是偶尔会遇到网络问题而超时失败,
用GitLab如果有引用GitHub其它库,感觉容易pod install失败,自己电脑没问题,换台电脑又不行 说找不到第三方,所以干脆还是用GitHub.
简单记录下用到的命令,方便以后复制。
1、创建空项目 名字 = JFTools
pod lib create JFTools
执行完会回答一些问题 然后自动打卡项目。
2、需要pod的文件替换到 JFTools/Classes,里面的路径又涉及到podspec里面的配置
3、替换完可以pod-> Example文件夹测试导入到项目运行,本地运行没问题才能上传。
4、Github里面创建空的库(空的啥都不加ReadMe.md也不加), 将URL路径和仓库地址配置到podspec
5、关联远程仓库
git add . git commit -m 'upload' git remote add origin https://github.com/xxx/xxx.git git push --set-upstream origin master
6、设置tag - 需要和podspec里面写的一致
git tag '0.1.0' git push --tag
7、本地验证和远程验证
pod lib lint --use-libraries --allow-warnings pod spec lint --use-libraries --allow-warnings //如果引用其他第三方库 pod spec lint --sources='https://gitlab.com/xxx/xxx.git,https://github.com/CocoaPods/Specs.git' --use-libraries --allow-warnings
8、提交索引文件
//Gitlab提交 pod repo push AGSpecs JFTools.podspec --use-libraries --allow-warnings // Github公共提交 pod repo push AGSpecs JFTools.podspec --use-libraries --allow-warnings
9、错误
ERROR | [iOS] unknown: Encountered an unknown error (/usr/bin/xcrun simctl list -j devices
解决方法 - Xcode>preferences>Locations 把tool选择当前xcode