首页 > 代码库 > 一个cocoapods问题的解决,希望能帮助到遇到相似情况的人

一个cocoapods问题的解决,希望能帮助到遇到相似情况的人

之前10.7的系统上执行过cocoapods没有问题。如今系统版本号升级到了10.9,尝试使用cocoapods遇到问题,报告了类似以下的错误:Psych::SyntaxError - (/Users/psteinacher/.cocoapods/repos/master/CocoaPods-version.yml): mapping values are not allowed in this context at line 3 column 4
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/psych.rb:205:in `parse‘
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/psych.rb:205:in `parse_stream‘
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/psych.rb:153:in `parse‘
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/psych.rb:129:in `load‘
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/psych.rb:299:in `block in load_file‘
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/psych.rb:299:in `open‘
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/psych.rb:299:in `load_file‘
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.28.0/lib/cocoapods/sources_manager.rb:248:in `version_information‘
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.28.0/lib/cocoapods/sources_manager.rb:209:in `repo_compatible?‘
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.28.0/lib/cocoapods/sources_manager.rb:268:in `master_repo_functional?‘
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.28.0/lib/cocoapods/command.rb:40:in `parse‘
/Library/Ruby/Gems/2.0.0/gems/claide-0.4.0/lib/claide/command.rb:179:in `parse‘
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.28.0/lib/cocoapods/command.rb:39:in `parse‘
/Library/Ruby/Gems/2.0.0/gems/claide-0.4.0/lib/claide/command.rb:211:in `run‘
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.28.0/lib/cocoapods/command.rb:52:in `run‘
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.28.0/bin/pod:24:in `<top (required)>‘经过多方尝试,发现运行例如以下的命令能够解决这个问题:
$ sudo rm -fr ~/.cocoapods/repos/master
$ pod setup最后推荐一个xcode插件,能够非常方便的使用cocoapods。CocoaPods for Xcode非常方便的Xcode pods插件。能够非常方便的在Xcode通过pods安装各种objective-c第三方库,省去曾经还要手动去跑pods命令行的麻烦;此外,还支持通过cocoaDocs来安装库文档。唯一的遗憾是,它眼下仅仅支持Xcode5,4版本号还用不了。项目地址:https://github.com/kattrali/cocoapods-xcode-pluginEnjoy it!