美文网首页
cocoapods 小知识

cocoapods 小知识

作者: 只懂搬砖的z_bl | 来源:发表于2020-05-09 14:19 被阅读0次

抑制警告 inhibit_warnings

inhibit_warnings参数能够有效的抑制CocoaPods引入的第三方代码库产生的warning。
这里所谓的第三方库产生的warning,指的是工程中不会再有第三方库内部的warning出现。

设置方式:

  • 单个设置方式

pod 'ReactiveCocoa', '~> 2.1', :inhibit_warnings => true

就是在pod 条目后面加上:inhibit_warnings => true的字样

  • 全局设置方式
platform :ios, '8.0'

inhibit_all_warnings!

在podfile文件的头文件下,写下inhibit_all_warnings!即可

注意🐖!

这样的效果,可能对某些第三方库有问题。具体可看:
禁止显示警告inhibit_all_warnings 可能有问题

遇到CDN: trunk URL couldn’t be downloaded:

问题出现场景:cocoapods升级到了1.9.0以上(其实升级到1.8.0以上就会出现),出现了CDN: trunk URL couldn’t be downloaded:问题

无论 install update search都报这个错

先说明原因:
CocoaPods 1.8将CDN切换为默认的spec repo源,并附带一些增强功能!所以导致了上面情况的出现

解决办法:
第一步:在Podfile里面添加Source

source ‘https://github.com/CocoaPods/Specs.git’
target ‘XXXDemo’ do
 use_frameworks!
 pod ‘YYModel’
end

此方法亲测有效的

但是仅限制于installupdatesearch还是报此错误。😢还要继续努力

第二步:移除trunk

pod repo remove trunk

完成后,再次search,成功了!

➜  demo git:(master) ✗ pod search mj        
Setup completed

查看当前ruby源

gem sources list或者gem sources -l
终端显示如下:

终端截图.png

原来的ruby源推荐使用
https://ruby.taobao.org
不过2016年下半年后这个淘宝源不在维护
改用:https://gems.ruby-china.org/

[!] Unable to satisfy the following requirements:

这个应该是你的本地的库太老了。不知道一些新的仓库。需要:
pod setup或者pod --repo-update
如果想升级完直接install,可以使用:
pod install --repo-update

相关文章

网友评论

      本文标题:cocoapods 小知识

      本文链接:https://www.haomeiwen.com/subject/csdknhtx.html