第三方库使用CocoaPods引入 问题汇总

updating......

- pod install

问题1:[!] Unable to find a specification for 'xxx'(找不到第三方框架)

  • pod repo update 更新一下repo,更新完成之后即可解决

问题2:Specs satisfying the ' XXXPods/Masonry (~> 1.0.15) ' dependency were found, but they required a higher minimum deployment target.

  • 检查PodFile文件里platform系统版本号,一般是因为版本低于依赖第三方库所支持的最低系统版本
  • 例如 platform :ios, '9.0'

- pod setup

问题1:[!] Unable to add a source with url 'https://github.com/CocoaPods/Specs.git' named 'master'. You can try adding it manually in '~/.cocoapods/repos' or via 'pod repo add'.

问题2:error: RPC failed; curl 18 transfer closed with outstanding read data remaining

fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

  • 网络问题,最直接的办法.....连热点操作.....
  • 也可以进入.cocoapods/repos/目录下直接克隆(也依赖网络)
    git clone https://github.com/CocoaPods/Specs.git

查看本地仓库

  • cd ~/.cocoapods
  • cd repos/
  • cd ls

问题:升级ruby后:find_spec_for_exe': can't find gem cocoapods (>= 0.a) (Gem::GemNotFoundException)

  • ruby路径问题,需要重新安装cocoapods
  • sudo gem uninstall cocoapods
    -gem install cocoapods
  • pod install
  • 紧接着可能出现以下问题

问题:

   CocoaPods : 1.3.1
        Ruby : ruby 2.4.4p296 (2018-03-28 revision 63013) [x86_64-darwin16]
    RubyGems : 2.7.7
        Host : Mac OS X 10.12.6 (16G29)
       Xcode :  ()
         Git : git version 2.14.3 (Apple Git-98)
Ruby lib dir : /Users/liqi/.rvm/rubies/ruby-2.4.4/lib

### Error

ArgumentError - Malformed version number string 
/Users/liqi/.rvm/rubies/ruby-2.4.4/lib/ruby/site_ruby/2.4.0/rubygems/version.rb:209:in `initialize'
/Users/liqi/.rvm/rubies/ruby-2.4.4/lib/ruby/site_ruby/2.4.0/rubygems/version.rb:200:in `new'
/Users/liqi/.rvm/rubies/ruby-2.4.4/lib/ruby/site_ruby/2.4.0/rubygems/version.rb:200:in `new'
/Users/liqi/.rvm/gems/ruby-2.4.4/gems/cocoapods-1.3.1/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb:119:in `embedded_content_settings'
/Users/liqi/.rvm/gems/ruby-2.4.4/gems/cocoapods-1.3.1/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb:64:in `generate'
/Users/liqi/.rvm/gems/ruby-2.4.4/gems/cocoapods-1.3.1/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb:39:in `save_as'
/Users/liqi/.rvm/gems/ruby-2.4.4/gems/cocoapods-1.3.1/lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb:109:in `update_changed_file'
/Users/liqi/.rvm/gems/ruby-2.4.4/gems/cocoapods-1.3.1/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb:87:in `block in create_xcconfig_file'
/Users/liqi/.rvm/gems/ruby-2.4.4/gems/cocoapods-1.3.1/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb:84:in `each'
/Users/liqi/.rvm/gems/ruby-2.4.4/gems/cocoapods-1.3.1/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb:84:in `create_xcconfig_file'
/Users/liqi/.rvm/gems/ruby-2.4.4/gems/cocoapods-1.3.1/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb:18:in `block in install!'
/Users/liqi/.rvm/gems/ruby-2.4.4/gems/cocoapods-1.3.1/lib/cocoapods/user_interface.rb:142:in `message'
/Users/liqi/.rvm/gems/ruby-2.4.4/gems/cocoapods-1.3.1/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb:14:in `install!'
/Users/liqi/.rvm/gems/ruby-2.4.4/gems/cocoapods-1.3.1/lib/cocoapods/installer/xcode/pods_project_generator.rb:173:in `block (2 levels) in install_libraries'
/Users/liqi/.rvm/gems/ruby-2.4.4/gems/cocoapods-1.3.1/lib/cocoapods/installer/xcode/pods_project_generator.rb:171:in `each'
/Users/liqi/.rvm/gems/ruby-2.4.4/gems/cocoapods-1.3.1/lib/cocoapods/installer/xcode/pods_project_generator.rb:171:in `block in install_libraries'
/Users/liqi/.rvm/gems/ruby-2.4.4/gems/cocoapods-1.3.1/lib/cocoapods/user_interface.rb:142:in `message'
/Users/liqi/.rvm/gems/ruby-2.4.4/gems/cocoapods-1.3.1/lib/cocoapods/installer/xcode/pods_project_generator.rb:165:in `install_libraries'
/Users/liqi/.rvm/gems/ruby-2.4.4/gems/cocoapods-1.3.1/lib/cocoapods/installer/xcode/pods_project_generator.rb:65:in `generate!'
/Users/liqi/.rvm/gems/ruby-2.4.4/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:183:in `block in generate_pods_project'
/Users/liqi/.rvm/gems/ruby-2.4.4/gems/cocoapods-1.3.1/lib/cocoapods/user_interface.rb:64:in `section'
/Users/liqi/.rvm/gems/ruby-2.4.4/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:182:in `generate_pods_project'
/Users/liqi/.rvm/gems/ruby-2.4.4/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:119:in `install!'
/Users/liqi/.rvm/gems/ruby-2.4.4/gems/cocoapods-1.3.1/lib/cocoapods/command/install.rb:41:in `run'
/Users/liqi/.rvm/gems/ruby-2.4.4/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/Users/liqi/.rvm/gems/ruby-2.4.4/gems/cocoapods-1.3.1/lib/cocoapods/command.rb:52:in `run'
/Users/liqi/.rvm/gems/ruby-2.4.4/gems/cocoapods-1.3.1/bin/pod:55:in `<top (required)>'
/Users/liqi/.rvm/gems/ruby-2.4.4/bin/pod:23:in `load'
/Users/liqi/.rvm/gems/ruby-2.4.4/bin/pod:23:in `<main>'
/Users/liqi/.rvm/gems/ruby-2.4.4/bin/ruby_executable_hooks:15:in `eval'
/Users/liqi/.rvm/gems/ruby-2.4.4/bin/ruby_executable_hooks:15:in `<main>'

cocoapods对应版本依赖,可以查看: https://rubygems.org/gems/cocoapods/versions/1.3.1
相关问题讨论见:https://github.com/CocoaPods/CocoaPods/issues/7765
#导致的原因主要是:
gem 2.7.7 can not run cocoapods 1.3.x . 1.4.x
you should install rubygem in 2.7.6-意思是要把rubygems回退到2.7.6

  • gem install rubygems-update -v 2.7.6
  • update_rubygems

问题:如果上一步回退rubygems遇到问题:

ERROR: Could not find a valid gem 'rubygems-update' (= 2.7.6) in any repository

ERROR: Possible alternatives: rubygems-update

就是国内网络的问题
查看安装源gem sources -l
如果安装源之前设置过阿里云(http://rubygems-china.oss.aliyuncs.com)或者其他,镜像没有更新新的版本,就会报错找不到对应版本信息。
可尝试直接添加一个安装源:https://rubygems.org/
gem sources -a https://rubygems.org/
然后 :) 连着手机热点跑命令gem install ruby gems-update -v 2.7.6update_rubygems
当看到以下信息时,说明成功了

bogon:shell liqi$ gem install rubygems-update -v 2.7.6
Fetching: rubygems-update-2.7.6.gem (100%)
Successfully installed rubygems-update-2.7.6
Parsing documentation for rubygems-update-2.7.6
Installing ri documentation for rubygems-update-2.7.6
Done installing documentation for rubygems-update after 44 seconds
1 gem installed
bogon:shell liqi$ update_rubygems
Bundler 1.16.1 installed
RubyGems 2.7.6 installed
Regenerating binstubs
Parsing documentation for rubygems-2.7.6
Installing ri documentation for rubygems-2.7.6

------------------------------------------------------------------------------

RubyGems installed the following executables:
    /Users/liqi/.rvm/rubies/ruby-2.4.4/bin/gem
    /Users/liqi/.rvm/rubies/ruby-2.4.4/bin/bundle

Ruby Interactive (ri) documentation was installed. ri is kind of like man 
pages for Ruby libraries. You may access it like this:
  ri Classname
  ri Classname.class_method
  ri Classname#instance_method
If you do not wish to install this documentation in the future, use the
--no-document flag, or set it as the default in your ~/.gemrc file. See
'gem help env' for details.

回退成功后,再执行命令:pod install,不出意外应该可以成功了。


问题:pod lib lint相关

ERROR: Could not find a valid gem 'rubygems-update' (= 2.7.6) in any repository

ERROR: Possible alternatives: rubygems-update

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 206,013评论 6 481
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 88,205评论 2 382
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 152,370评论 0 342
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 55,168评论 1 278
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 64,153评论 5 371
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,954评论 1 283
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,271评论 3 399
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,916评论 0 259
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 43,382评论 1 300
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,877评论 2 323
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,989评论 1 333
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,624评论 4 322
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,209评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,199评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,418评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,401评论 2 352
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,700评论 2 345

推荐阅读更多精彩内容

  • 说明 本文是作者Lefe所创,转载请注明出处,如果你在阅读的时候发现问题欢迎一起讨论。本文会不断更新。 正文 ht...
    Lefe阅读 389评论 0 1
  • 项目组件化、平台化是技术公司的共同目标,越来越多的技术公司推崇使用pod管理第三方库以及私有组件,一方面使项目架构...
    swu_luo阅读 21,466评论 0 39
  • 最近想为公司搭建cocoapods私有库框架,老早之前做过,踩过不少坑,想不到又一次掉坑里。果真是好记性不如烂笔头...
    生光阅读 1,521评论 0 4
  • 六月二十一日,天气晴朗,我们一大早就起床了, 驱车从南京前往无锡,八点就到了无锡市中央电视台无锡影视基地。 ...
    亲近自然1阅读 497评论 0 2
  • 001 别太自恋 与其向别人证明自己是个有趣的人,不如多留心挖掘一下别人身上的有趣之处。可以多做有趣的事,成为有趣...
    朱朱的餐具阅读 340评论 0 2