Cocopod更新第三方库失败

Xcode升级了10.0之后更新第三方库时失败了。报如下所示错误:

### Error

 

```

RuntimeError - [!] Xcodeproj doesn't know about the following attributes {"inputFileListPaths"=>[], "outputFileListPaths"=>[]} for the 'PBXShellScriptBuildPhase' isa.

If this attribute was generated by Xcode please file an issue: https://github.com/CocoaPods/Xcodeproj/issues/new

/Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.6/lib/xcodeproj/project/object.rb:321:in `configure_with_plist'

/Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.6/lib/xcodeproj/project.rb:262:in `new_from_plist'

/Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.6/lib/xcodeproj/project/object.rb:350:in `object_with_uuid'

/Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.6/lib/xcodeproj/project/object.rb:300:in `block (2 levels) in configure_with_plist'

/Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.6/lib/xcodeproj/project/object.rb:299:in `each'

/Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.6/lib/xcodeproj/project/object.rb:299:in `block in configure_with_plist'

/Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.6/lib/xcodeproj/project/object.rb:296:in `each'

/Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.6/lib/xcodeproj/project/object.rb:296:in `configure_with_plist'

/Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.6/lib/xcodeproj/project.rb:262:in `new_from_plist'

/Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.6/lib/xcodeproj/project/object.rb:350:in `object_with_uuid'

/Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.6/lib/xcodeproj/project/object.rb:300:in `block (2 levels) in configure_with_plist'

/Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.6/lib/xcodeproj/project/object.rb:299:in `each'

/Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.6/lib/xcodeproj/project/object.rb:299:in `block in configure_with_plist'

/Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.6/lib/xcodeproj/project/object.rb:296:in `each'

/Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.6/lib/xcodeproj/project/object.rb:296:in `configure_with_plist'

/Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.6/lib/xcodeproj/project.rb:262:in `new_from_plist'

/Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.6/lib/xcodeproj/project.rb:203:in `initialize_from_file'

/Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.6/lib/xcodeproj/project.rb:103:in `open'

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.4.0/lib/cocoapods/installer/analyzer.rb:907:in `block (2 levels) in inspect_targets_to_integrate'

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.4.0/lib/cocoapods/installer/analyzer.rb:906:in `each'

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.4.0/lib/cocoapods/installer/analyzer.rb:906:in `block in inspect_targets_to_integrate'

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.4.0/lib/cocoapods/user_interface.rb:64:in `section'

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.4.0/lib/cocoapods/installer/analyzer.rb:901:in `inspect_targets_to_integrate'

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.4.0/lib/cocoapods/installer/analyzer.rb:75:in `analyze'

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.4.0/lib/cocoapods/installer.rb:243:in `analyze'

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.4.0/lib/cocoapods/installer.rb:154:in `block in resolve_dependencies'

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.4.0/lib/cocoapods/user_interface.rb:64:in `section'

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.4.0/lib/cocoapods/installer.rb:153:in `resolve_dependencies'

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.4.0/lib/cocoapods/installer.rb:116:in `install!'

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.4.0/lib/cocoapods/command/install.rb:41:in `run'

/Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.4.0/lib/cocoapods/command.rb:52:in `run'

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.4.0/bin/pod:55:in `<top (required)>'

/usr/local/bin/pod:23:in `load'

/usr/local/bin/pod:23:in `<main>'

 

于是开始升级cocoapod。

1、首先检查Ruby镜像

$ gem sources -l

如果是:https://gems.ruby-china.org/ 则进行第二 步。如果不是,先移除现有的Ruby镜像

$ gem sources --remove https://rubygems.org/

然后添加国内最新镜像源(淘宝的Ruby镜像已经不更新了)

 $ gem sources -a https://gems.ruby-china.org/

 执行完之后再执行$ gem sources -l检查一下。

2、升级gem

$ sudo gem update --system

但是升级失败,报如下错误:

ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)

    bad response Not Found 404 (https://gems.ruby-china.org/specs.4.8.gz)

再按以下步骤安装:$ sudo gem sources -r https://rubygems.org

$ sudo gem sources -a http://rubygems.org

过程如下:

saihuawangdeiMac:$ sudo gem sources -r https://rubygems.org

source https://rubygems.org not present in cache

saihuawangdeiMac:$ sudo gem sources -a http://rubygems.org

https://rubygems.org is recommended for security over http://rubygems.org

 

Do you want to add this insecure source? [yn]  y

http://rubygems.org added to sources

3、使用rvm安装ruby

安装RVM

$ curl -L get.rvm.io | bash -s stable

saihuawangdeiMac:$ source ~/.bashrc

saihuawangdeiMac:$ source ~/.bash_profile

saihuawangdeiMac:$ rvm -v

rvm 1.29.4 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]

$ rvm install 2.5.1

如下所示就是安装好了:

Searching for binary rubies, this might take some time.

No binary rubies available for: osx/10.13/x86_64/ruby-2.5.1.

Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.

Checking requirements for osx.

Installing requirements for osx.

Updating system..........

Installing required packages: openssl@1.1...

Certificates bundle '/usr/local/etc/openssl@1.1/cert.pem' is already up to date.

Requirements installation successful.

Installing Ruby from source to: /Users/saihuawang/.rvm/rubies/ruby-2.5.1, this may take a while depending on your cpu(s)...

ruby-2.5.1 - #downloading ruby-2.5.1, this may take a while depending on your connection...

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

100 13.3M  100 13.3M    0     0   585k      0  0:00:23  0:00:23 --:--:--  847k

ruby-2.5.1 - #extracting ruby-2.5.1 to /Users/saihuawang/.rvm/src/ruby-2.5.1...|

ruby-2.5.1 - #configuring......................................................|

ruby-2.5.1 - #post-configuration.

ruby-2.5.1 - #compiling........................................................-

ruby-2.5.1 - #installing.........

ruby-2.5.1 - #making binaries executable..

ruby-2.5.1 - #downloading rubygems-2.7.7

ruby-2.5.1 - #extracting rubygems-2.7.7......

ruby-2.5.1 - #removing old rubygems........

ruby-2.5.1 - #installing rubygems-2.7.7................................

ruby-2.5.1 - #gemset created /Users/saihuawang/.rvm/gems/ruby-2.5.1@global

ruby-2.5.1 - #importing gemset /Users/saihuawang/.rvm/gemsets/global.gems......|

ruby-2.5.1 - #generating global wrappers.......

ruby-2.5.1 - #gemset created /Users/saihuawang/.rvm/gems/ruby-2.5.1

ruby-2.5.1 - #importing gemsetfile /Users/saihuawang/.rvm/gemsets/default.gems evaluated to empty gem list

ruby-2.5.1 - #generating default wrappers.......

ruby-2.5.1 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).

Install of ruby-2.5.1 - #complete

4、安装cocoapods(需在根目录下)

$ sudo gem install cocoapods

Sending stats

Pod installation complete! There are 17 dependencies from the Podfile and 15 total pods installed.

安装成功。

安装失败情况:WARNING:  Unable to pull data from 'https://gems.ruby-china.org/': bad response Not Found 404 (https://gems.ruby-china.org/specs.4.8.gz)

因为Ruby China 官方 RubyGems 镜像发生改变,所以需要替换成新域名

RubyChina 官方公告
Ruby China 官方公告

1、查看镜像

gem source -l

2、如果镜像不是https://gems.ruby-china.com,则需要用以下命令替换。

gem sources --add https://gems.ruby-china.com --remove https://rubygems.org/

3、如果有多余的镜像可以用以下命令删除

gem source --remove 镜像路径

4、最后安装cocoapods

gem install cocoapods

没有更多推荐了,返回首页