可可豆荚更新破坏了一些东西,现在“豆荚更新”会产生错误

Posted

技术标签:

【中文标题】可可豆荚更新破坏了一些东西,现在“豆荚更新”会产生错误【英文标题】:cocoa pods update broke something, now "pod update" produces errors 【发布时间】:2018-11-30 21:22:18 【问题描述】:

我从 CocoaPods 1.3.1 升级到 1.5.3。我正在使用 Xcode 9.2

我在安装 pod 时遇到问题。期望它正确安装所有 pod 依赖项。

相反,中途出现以下错误:

LoadError - 无法加载这样的文件——macho /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/cocoapods-1.5.3/lib/cocoapods/sandbox/file_accessor.rb:432:in rescue in dynamic_binary?' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/cocoapods-1.5.3/lib/cocoapods/sandbox/file_accessor.rb:427:indynamic_binary? /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/cocoapods-1.5.3/lib/cocoapods/sandbox/file_accessor.rb:164:in block in vendored_dynamic_frameworks' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/cocoapods-1.5.3/lib/cocoapods/sandbox/file_accessor.rb:163:inselect' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/cocoapods-1.5.3/lib/cocoapods/sandbox/file_accessor.rb:163:in vendored_dynamic_frameworks' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/cocoapods-1.5.3/lib/cocoapods/sandbox/file_accessor.rb:172:invendored_static_frameworks' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/cocoapods-1.5.3/lib/cocoapods/sandbox/file_accessor.rb:238:in vendored_static_artifacts' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/cocoapods-1.5.3/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb:56:inblock in generate' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/cocoapods-1.5.3/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb:56:in each' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/cocoapods-1.5.3/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb:56:inany?' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/cocoapods-1.5.3/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb:56:in generate' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/cocoapods-1.5.3/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb:39:insave_as' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/cocoapods-1.5.3/lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb:107:in update_changed_file' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/cocoapods-1.5.3/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb:96:inblock in create_xcconfig_file' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/cocoapods-1.5.3/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb:93:in each' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/cocoapods-1.5.3/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb:93:increate_xcconfig_file' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/cocoapods-1.5.3/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb:18:in block in install!' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/cocoapods-1.5.3/lib/cocoapods/user_interface.rb:142:inmessage' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/cocoapods-1.5.3/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb:14:in install!' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/cocoapods-1.5.3/lib/cocoapods/installer/xcode/pods_project_generator.rb:181:inblock (2 个级别) in安装库' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/cocoapods-1.5.3/lib/cocoapods/installer/xcode/pods_project_generator.rb:179:in each' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/cocoapods-1.5.3/lib/cocoapods/installer/xcode/pods_project_generator.rb:179:inblock in install_libraries' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/cocoapods-1.5.3/lib/cocoapods/user_interface.rb:142:in message' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/cocoapods-1.5.3/lib/cocoapods/installer/xcode/pods_project_generator.rb:167:ininstall_libraries' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/cocoapods-1.5.3/lib/cocoapods/installer/xcode/pods_project_generator.rb:65:in generate!' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:184:inblock in generate_pods_project' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/cocoapods-1.5.3/lib/cocoapods/user_interface.rb:64:in section' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:183:ingenerate_pods_project' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:119:in install!' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/cocoapods-1.5.3/lib/cocoapods/command/install.rb:41:inrun' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/claide-1.0.2/lib/claide/command.rb:334:in run' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:52:inrun' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/cocoapods-1.5.3/bin/pod:55:in <top (required)>' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/bin/pod:23:inload' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/bin/pod:23:in <main>' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:ineval' /Users/kdanielwong/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `'

CocoaPods 环境

吊舱环境

堆栈

CocoaPods : 1.5.3 Ruby : ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin12.0] RubyGems : 2.5.0 Host : Mac OS X 10.12.6 (16G1408) Xcode : 9.2 (9C40b) Git : git version 2.14.3 (Apple Git-98) Ruby lib dir : /Users/kdanielwong/.rvm/rubies/ruby-2.1.1/lib Repositories : master - https://github.com/CocoaPods/Specs.git @ 0394a8486df6a54691151f75289676af4c7237d5

安装源

可执行路径:/Users/kdanielwong/.rvm/gems/ruby-2.1.1/bin/pod

插件

cocoapods-deintegrate : 1.0.2 cocoapods 插件:1.0.0 cocoapods 搜索:1.0.0 可可足统计:1.0.0 可可足树干:1.3.0 cocoapods-try : 1.1.0

播客文件

ruby
platform :ios, '9.0'

target 'IGapp' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
use_frameworks!

  # Pods for IGapp
pod 'Firebase/Database'
pod 'Firebase/Storage'
pod 'Firebase/Auth'
pod 'AFNetworking', '~> 3.0'
pod 'SDWebImage', '~> 4.0'
pod 'TOCropViewController'

  target 'IGappTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'IGappUITests' do
    inherit! :search_paths
    # Pods for testing
  end

结束

我已尝试卸载和安装 ruby​​ macho,但没有帮助。

宝石哪个男子气概 /Users/kdanielwong/.rvm/gems/ruby-2.1.1/gems/ruby-macho-1.2.0/lib/macho.rb

知道我还能尝试什么吗?

【问题讨论】:

【参考方案1】:

感谢the cocoapods GitHub repository 的评论,我去编辑堆栈跟踪顶部的文件(file_accessor.rb)并将顶行从:autoload :MachO, 'macho' 更改为require 'macho'

问题就解决了!

【讨论】:

【参考方案2】:

对我有用的方法是删除当前版本:

gem uninstall ruby-macho

然后重新安装:

gem install ruby-macho --source=http://rubygems.org

检查此线程https://github.com/CocoaPods/CocoaPods/issues/6602。

【讨论】:

我已经看到并尝试过了,但它在我的情况下不起作用,可可豆荚 1.5.3。不过,它似乎适用于一些在 2017 年升级到 coco pods 1.1.1 或 1.2 时遇到类似问题的人。

以上是关于可可豆荚更新破坏了一些东西,现在“豆荚更新”会产生错误的主要内容,如果未能解决你的问题,请参考以下文章

如何从 Xcode 项目中删除其中一个可可豆荚插件

更新可可豆荚后xcode重复符号架构错误

Alamofire 在 swift 2.2 中抛出错误

Xcode 12 无法构建可可豆荚 - 生成伞头 [关闭]

React Native Project 错误:ld:找不到框架 GoogleAdMob

在监视目标中使用 fastlane 和可可豆荚进行构建的问题