情况描述:
使用synx整理工程结构时出现如下错误:
Did you mean? StringIO
from /Users/home/.rvm/gems/ruby-2.3.1/gems/xcodeproj-1.4.0/lib/xcodeproj/plist.rb:27:in `new'
from /Users/home/.rvm/gems/ruby-2.3.1/gems/xcodeproj-1.4.0/lib/xcodeproj/plist.rb:27:in `read_from_path'
from /Users/home/.rvm/gems/ruby-2.3.1/gems/xcodeproj-1.4.0/lib/xcodeproj/project.rb:200:in `initialize_from_file'
from /Users/home/.rvm/gems/ruby-2.3.1/gems/xcodeproj-1.4.0/lib/xcodeproj/project.rb:102:in `open'
from /Users/home/.rvm/gems/ruby-2.3.1/gems/synx-0.2.1/bin/synx:24:in `execute'
from /Users/home/.rvm/gems/ruby-2.3.1@global/gems/clamp-0.6.5/lib/clamp/command.rb:67:in `run'
from /Users/home/.rvm/gems/ruby-2.3.1@global/gems/clamp-0.6.5/lib/clamp/command.rb:132:in `run'
from /Users/home/.rvm/gems/ruby-2.3.1@global/gems/clamp-0.6.5/lib/clamp.rb:6:in `Clamp'
from /Users/home/.rvm/gems/ruby-2.3.1/gems/synx-0.2.1/bin/synx:6:in `<top (required)>'
from /Users/home/.rvm/gems/ruby-2.3.1/bin/synx:23:in `load'
from /Users/home/.rvm/gems/ruby-2.3.1/bin/synx:23:in `<main>'
from /Users/home/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `eval'
from /Users/home/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `<main>'
出现的问题
一: ruby版本问题, 当前的ruby版本和自己想要使用的不对
Username:~ home$ rvm list
rvm rubies
ruby-2.3.0 [ missing bin/ruby ]
=* ruby-2.3.1 [ x86_64 ]
# => - current
# =* - current && default
# * - default
跟换ruby当前版本使用
rvm use 2.3.1 --default
二:xcodeproj版本不对
xcodeproj (1.4.0, 1.3.3)
如上所示, xcodeproj有两个版本, 会导致synx失效, 删除掉其中一个版本使用
gem uninstall xcodeproj 1.4.0
再查看gem版本xcodeproj只剩下一个就对了
Username:~ home$ gem list
*** LOCAL GEMS ***
xcodeproj (1.3.3)
最终解决以上两个问题后我遇到的synx失效问题顺利解决