制作cocoapods库问题汇总

1.   - NOTE | [iOS] xcodebuild: ZLImageTextButton/ZLImageTextButton/ZLImageTextButton/ZLImageTextButton.m:10:9: fatal error: 'Masonry.h' file not found

如图:

我的demo里面含有了masonry,但是我自己写的库是不需要用到masonry的,而我的项目是用了pod来创建的。在检查的时候一直报找不到masonry这个错误。

最后无奈在podspec文件里面加入了s.dependency "Masonry"才检查通过。

如图



2.- ERROR | [iOS] unknown: Encountered an unknown error ([!] /usr/bin/git clone https://github.com/czl0325/ZLImageTextButton.git /var/folders/bz/p707_css28d4g44cwly5g8t80000gn/T/d20171122-16595-cjkfp1 --template= --single-branch --depth 1 --branch 0.0.1



这是因为没有为项目打上tag的缘故

执行     

$ git add -A && git commit -m "创建版本 0.0.1."

$ git tag '0.0.1'

$ git push --tags

$ git push origin master

或者

 git tag -m "podspec" "0.0.1"                                                                                                                               

git push origin --tags

加上tag。



3.认领自己的pod

网址:https://trunk.cocoapods.org/claims/new



4.

github中删除release/tag只能在命令执行,不能界面点击操作

假若需要删除一个 v1.1.1 的release版本

git tag -d v1.1.1;

git push origin :v1.1.1


5.

将我们的gitHub仓库代码配置CocoPods支持的时候

执行最后一步命令:

pod trunk push 工程名.podspec

报错如下:

[!] You need to register a session first.

解决方案命令如下:

pod trunk register 电子邮箱 '您的姓名' --description='你的描述'


6.

推送的时候忽略所有警告

pod trunk push --allow-warnings


7. Unable to accept duplicate entry for: ********

那么说明已经提交到cocoapods仓库成功,那么有可能就是本地仓库没有更新.更新本地仓库:

pod repo update

再次执行pod search ******命令,如果还搜索不到,继续往下看:

rm ~/Library/Caches/CocoaPods/search_index.json

这句话是移除已经生成的搜索目录缓存文件,移除之后,执行pod search会重新生成一份最新的缓存列表,基本到这里就差不多了.

如果还有问题,那就需要终极大招,但是不推荐用,时间很长,除非翻墙.

pod repo remove master 

pod setup

或者

sudo rm -fr ~/.cocoapods/repos/master

pod setup

这两种写法的意思都是移除本地cocoapods仓库,重新从官网拉取一遍.可能时间比较长,所以不建议用,如果网速度快可以考虑使用,也可以翻墙.整个仓库打下大约500M+(截止当前时间).


7.  CocoaPods was not able to update the `master` repo. If this is an unexpected issue and persists you can inspect it running `pod repo update --verbose`

先:

git config --global http.postBuffer 524288000

在运行

pod repo update --verbose

如果问题还不能解决,就重新安装,步骤如下:

先删除全局的缓存:

sudo rm -fr ~/Library/Caches/CocoaPods/

sudo rm -fr ~/.cocoapods/repos/master/

把当前 Pods 目录清空:

sudo rm -fr Pods/

然后,重新安装cocoapods

sudo gem install cocoapods 

温馨提示:苹果系统升级 OS X EL Capitan 后改为 

sudo gem install -n /usr/local/bin cocoapods

再次

pod setup


8.  ERROR | [iOS] unknown: Encountered an unknown error ([!] /usr/bin/git clone https://github.com/czl0325/ZLCollectionView.git /var/folders/fz/lhl6qsd93lg09b2j83lsmch40000gn/T/d20180713-995-q3defl --template= --single-branch --depth 1 --branch 0.5.3


尝试  sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer后再执行。



9.

- ERROR | [iOS] unknown: Encountered an unknown error (/usr/bin/xcrun simctl list -j devices

解决方法:https://blog.csdn.net/xjh093/article/details/82888235



10. 

unable to find utility "simctl", not a developer tool or in PATH) during validation



xcode设置里面,将Command line Tools设置一下,在Xcode>preferences>Locations里面,设置之后再运行终端即可




11.Unable to add a source with url `https://cdn.cocoapods.org/` named `trunk`. You can try adding it manually in `/var/root/.cocoapods/repos` or via `pod repo add`.

czl:ZLCollectionView zhaoliangchen$ pod trunk push --allow-warnings[!]

Found podspec `ZLCollectionViewFlowLayout.podspec`

Adding spec repo `trunk` with CDN `https://cdn.cocoapods.org/`

[!] Unable to add a source with url `https://cdn.cocoapods.org/` named `trunk`.You can try adding it manually in `/var/root/.cocoapods/repos` or via `pod repo add`.


解决方法:前往/var把root文件夹设置成可读写。并创建.cocoapods目录


12. ERROR | [iOS] unknown: Encountered an unknown error (Permission denied @ dir_s_mkdir - /var/root/Library/Caches/CocoaPods) during validation.

同理:在/var/root/Library/Caches中创建CocoaPods文件夹


13.Authentication token is invalid or unverified. Either verify it with the email that was sent or register a new session.

pod trunk register '295183917@qq.com' 'czl0325' --description='macbookpro'

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容