新建一个工程时,想使用pod导入几个第三方库,但是遇到了下面的问题:
――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
### Command
```
/usr/local/bin/pod init
```
### Report
* What did you do?
* What did you expect to happen?
* What happened instead?
### Stack
```
CocoaPods : 1.3.1
Ruby : ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin17]
RubyGems : 2.6.14
Host : Mac OS X 10.13.6 (17G65)
Xcode : 9.4.1 (9F2000)
Git : git version 2.15.2 (Apple Git-101.1)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ 3e5bfb65b4be67ff7da7635411e4ee0db312c042
```
### Plugins
```
cocoapods-deintegrate : 1.0.1
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-stats : 1.0.0
cocoapods-trunk : 1.3.0
cocoapods-try : 1.1.0
```
### Error
```
RuntimeError - [Xcodeproj] Unknown object version.
/Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.3/lib/xcodeproj/project.rb:217:in `initialize_from_file'
/Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.3/lib/xcodeproj/project.rb:102:in `open'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/command/init.rb:41:in `validate!'
/Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:333:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.3.1/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
```
――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
[!] Oh no, an error occurred.
Search for existing GitHub issues similar to yours:
https://github.com/CocoaPods/CocoaPods/search?q=%5BXcodeproj%5D+Unknown+object+version.&type=Issues
If none exists, create a ticket, with the template displayed above, on:
https://github.com/CocoaPods/CocoaPods/issues/new
Be sure to first read the contributing guide for details on how to properly submit a ticket:
https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md
Don't forget to anonymize any private data!
Looking for related issues on cocoapods/cocoapods...
- RuntimeError - [Xcodeproj] Unknown object version.
https://github.com/CocoaPods/CocoaPods/issues/7697 [closed] [31 comments]
a day ago
- Pod Update: RuntimeError - [Xcodeproj] Unknown object version. Xcode Beta 5
https://github.com/CocoaPods/CocoaPods/issues/8003 [closed] [17 comments]
19 Aug 2018
- RuntimeError - [Xcodeproj] Unknown object version.
https://github.com/CocoaPods/CocoaPods/issues/7458 [closed] [15 comments]
30 Jul 2018
and 42 more at:
https://github.com/cocoapods/cocoapods/search?q=[Xcodeproj]%20Unknown%20object%20version.&type=Issues&utf8=✓
RuntimeError - [Xcodeproj] Unknown object version.这句话的意思是Xcode工程版本与pod对不上,于是敲入命令行gem install cocoapods --pre来更新pod的版本。
又遇到了一个错误:
ERROR: Could not find a valid gem 'cocoapods' (>= 0), here is why:
Unable to download data from https://ruby.taobao.org/ - bad response Not Found 404 (https://gems.ruby-china.org/specs.4.8.gz)
gem的淘宝链接失效。于是把链接修改为新的有效链接,命令行如下:
删除原有的资源链接:gem sources -r https://ruby.taobao.org/
添加新的有效资源链接:gem sources -a https://gems.ruby-china.com/
再次返回命令行敲入:gem install cocoapods --pre 重新安装了pod
再执行pod init
pod 初始化成功。文件夹中出现了久违的Podfile。
希望对你们有帮助。