最近使用CocoaPods的时候,在 pod install的时候出现错误:ArgumentError - Malformed version number string,详细信息如下:
相关版本信息如下:
CocoaPods : 1.5.2
Ruby : ruby 2.3.3p222 (2016-11-21 revision 56859) [universal.x86_64-darwin17]
RubyGems : 2.7.7
Host : Mac OS X 10.13.4 (17E202)
Xcode : 9.3 (9E145)
Git : git version 2.15.1 (Apple Git-101)
错误信息如下:
### Error
ArgumentError - Malformed version number string
/Library/Ruby/Site/2.3.0/rubygems/version.rb:209:in `initialize'
/Library/Ruby/Site/2.3.0/rubygems/version.rb:200:in `new'
/Library/Ruby/Site/2.3.0/rubygems/version.rb:200:in `new'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.2/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb:123:in `embedded_content_settings'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.2/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb:68:in `generate'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.2/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb:39:in `save_as'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.2/lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb:112:in `update_changed_file'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.2/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb:96:in `block in create_xcconfig_file'
.......
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.2/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.2/bin/pod:55:in `'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `'
```
网上找了方法,在github上看到有人出现类似情况,链接:
Malformed version number string · Issue #7765 · CocoaPods/CocoaPods · GitHub
有网友回复如下:
前面报错信息里面有提示: Ruby : ruby 2.3.3p222 (2016-11-21 revision 56859),
我使用RVM 安装ruby 2.4.1 ,安装完后,再运行 pod install,问题解决,如下:
安装步骤就不详写了,网上一搜很多的。
附上别人写的两个链接供参考:
RVM安装:cocopods卸载、安装、重装等问题解决
CocoaPods安装:iOS安装CocoaPods详细过程