CocoaPods搭建私有库遇到问题

作者: __Mr_Xie__ | 来源:发表于2018-12-26 10:09 被阅读10次

    前言

    CocoaPods搭建私有库过程中,有人碰到问题,根据反馈,我就不一一回复了,写篇文章统一回复。

    反馈的问题

    使用 pod lib create XXX 命令会出现下面这个问题:

    ```/Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.8/lib/xcodeproj/project/object/helpers/build_settings_array_settings_by_object_version.rb:27:in <module:BuildSettingsArraySettingsByObjectVersion>': undefined methodto_set' for #<Array:0x007fbe0d0960c8> (NoMethodError)
    Did you mean? to_s
    from /Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.8/lib/xcodeproj/project/object/helpers/build_settings_array_settings_by_object_version.rb:8:in <class:XCBuildConfiguration>' from /Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.8/lib/xcodeproj/project/object/helpers/build_settings_array_settings_by_object_version.rb:4:in<module:Object>'
    from /Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.8/lib/xcodeproj/project/object/helpers/build_settings_array_settings_by_object_version.rb:3:in <class:Project>' from /Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.8/lib/xcodeproj/project/object/helpers/build_settings_array_settings_by_object_version.rb:2:in<module:Xcodeproj>'
    from /Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.8/lib/xcodeproj/project/object/helpers/build_settings_array_settings_by_object_version.rb:1:in <top (required)>' from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:inrequire'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require' from /Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.8/lib/xcodeproj/project/object/build_configuration.rb:194:in<top (required)>'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require' from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:inrequire'
    from /Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.8/lib/xcodeproj/project/object.rb:521:in <top (required)>' from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:inrequire'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require' from /Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.8/lib/xcodeproj/project.rb:5:in<top (required)>'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require' from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:inrequire'
    from /Users/liuchuan/LAXCategoryKit/setup/ProjectManipulator.rb:30:in run' from /Users/liuchuan/LAXCategoryKit/setup/ConfigureiOS.rb:73:inperform'
    from /Users/liuchuan/LAXCategoryKit/setup/ConfigureiOS.rb:7:in perform' from /Users/liuchuan/LAXCategoryKit/setup/TemplateConfigurator.rb:85:inrun'
    from ./configure:9:in `<main>'

    To learn more about the template see https://github.com/CocoaPods/pod-template.git.
    To learn more about creating a new pod, see http://guides.cocoapods.org/making/making-a-cocoapod.```

    解决方案步骤:

    1、在~/.cocoapods/repos目录,把Xcodeproj clone到该目录下;

    image

    2、在~/.cocoapods/repos/Xcodeproj目录,执行终端命令:

    gem build xcodeproj.gemspec

    3、在~/.cocoapods/repos/Xcodeproj目录,执行终端命令:

    sudo gem install ./xcodeproj-1.7.0.gem

    注:在执行终端命令:sudo gem install ./xcodeproj-1.7.0.gem过程中,如果ruby版本过低,会出现问题:/usr/bin Operation not permitted。解决办法:将ruby升级到最新版本,重新安装CocoaPods。

    image
                            (长按图片,识别图中的微信二维码)
    
                            也可以关注我的新浪微博“__Mr_Xie__”
    

    相关文章

      网友评论

        本文标题:CocoaPods搭建私有库遇到问题

        本文链接:https://www.haomeiwen.com/subject/nwwclqtx.html