CocoaPods搭建私有库遇到问题

前言

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 `': undefined method `to_set' for # (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 `'
    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 `'
    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 `'
    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 `'
    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 `'
    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:in `require'
    from /Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.8/lib/xcodeproj/project/object/build_configuration.rb:194:in `'
    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:in `require'
    from /Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.8/lib/xcodeproj/project/object.rb:521:in `'
    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:in `require'
    from /Library/Ruby/Gems/2.3.0/gems/xcodeproj-1.5.8/lib/xcodeproj/project.rb:5:in `'
    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:in `require'
    from /Users/liuchuan/LAXCategoryKit/setup/ProjectManipulator.rb:30:in `run'
    from /Users/liuchuan/LAXCategoryKit/setup/ConfigureiOS.rb:73:in `perform'
    from /Users/liuchuan/LAXCategoryKit/setup/ConfigureiOS.rb:7:in `perform'
    from /Users/liuchuan/LAXCategoryKit/setup/TemplateConfigurator.rb:85:in `run'
    from ./configure:9:in `
' 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到该目录下;

CocoaPods搭建私有库遇到问题_第1张图片
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。

更多文章

CocoaPods开源库的搭建
CocoaPods搭建私有库
CocoaPods搭建私有库遇到问题
CocoaPods私有库的升级维护
SKStoreReviewController之程序内评价
App应用程序图标的动态更换
开源框架 MGJRouter_Swift
iOS的MVP设计模式
iOS插件化
iOS FMDB的使用
Swift之ReactiveSwift
OC之ReactiveCocoa
OC之ReactiveCocoa进阶
iOS 性能考虑

CocoaPods搭建私有库遇到问题_第2张图片

你可能感兴趣的:(CocoaPods搭建私有库遇到问题)