当前位置: 首页 > 知识库问答 >
问题:

Cocoapods: LoadError-没有要加载的此类文件

冉德元
2023-03-14

我正在尝试向我的Xcode项目添加一个pod。我收到这个错误:

LoadError——没有这样的文件要加载——xcodeproj/prebuild/universal-darwin13。0-1.8.7/xcodeproj_ext/Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require。rb:55:ingem_original_require'/Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require。rb:55:inrequire'/Library/Ruby/Gems/1.8/Gems/xcodeproj-0.14.0/lib/xcodeproj/ext.rb:6/Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require。rb:55:ingem_original_require'/Library/Ruby/Site/1.8/html" target="_blank">rubygems/core_ext/kernel_require。rb:55:inrequire'/Library/Ruby/Gems/1.8/Gems/xcodeproj-0.14.0/lib/xcodeproj/project。rb:4/Library/Ruby/Gems/1.8/Gems/cocoapods-0.27.1/lib/cocoapods/installer/analyzer。rb:488:incompute_target_platforms'/Library/Ruby/Gems/1.8/Gems/cocoapods-0.27.1/lib/cocoapods/installer/analyzer。rb:485:ineach'/Library/Ruby/Gems/1.8/Gems/cocoapods-0.27.1/lib/cocoapods/installer/analyzer。rb:485:incompute_target_platforms'/Library/Ruby/Gems/1.8/Gems/cocoapods-0.27.1/lib/cocoapods/installer/analyzer。rb:55:inanalyze'/Library/Ruby/Gems/1.8/Gems/cocoapods-0.27.1/lib/cocoapods/installer。rb:171:inanalyze'/Library/Ruby/Gems/1.8/Gems/cocoapods-0.27.1/lib/cocoapods/installer。rb:94:inresolve_dependencies'/Library/Ruby/Gems/1.8/Gems/cocoapods-0.27.1/lib/cocoapods/user_interface。rb:52:insection'/Library/Ruby/Gems/1.8/Gems/cocoapods-0.27.1/lib/cocoapods/installer。rb:93:inresolve_dependencies'/Library/Ruby/Gems/1.8/Gems/cocoapods-0.27.1/lib/cocoapods/installer。rb:86:ininstall!'/Library/Ruby/Gems/1.8/Gems/cocoapods-0.27.1/lib/cocoapods/command/project。rb:38:inrun\u install\u with\u update“/Library/Ruby/Gems/1.8/Gems/cocoapods-0.27.1/lib/cocoapods/command/project。rb:68:inrun'/Library/Ruby/Gems/1.8/Gems/claide-0.3.2/lib/claide/command。rb:206:inrun'/Library/Ruby/Gems/1.8/Gems/cocoapods-0.27.1/lib/cocoapods/command。rb:51:inrun'/Library/Ruby/Gems/1.8/Gems/cocoapods-0.27.1/bin/pod:19/usr/bin/pod:23:inload'/usr/bin/pod:23

我的podfile内容:

pod 'RestKit', '~> 0.21.0'

任何帮助都将不胜感激!

共有3个答案

冯宏浚
2023-03-14

如果您正在使用10.10,并且看到这个错误(/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/Ruby/2.0.0/rubygems/core\u ext/kernel\u require.rb:55:)请尝试以下方法

Open Xcode 6 > Preferences > Locations
Command Line Tools version to Xcode 6.0
Uninstall cocoapods/xcodeproj then re-install.

sudo gem uninstall cocoapods
sudo gem uninstall xcodeproj
sudo gem install xcodeproj
sudo gem install cocoapods

pod --version 
易京
2023-03-14

终于找到了解决方案:我在具有相同项目的同一台机器上运行旧Xcode4和新Xcode5。在某个时候,我似乎丢失了命令行工具(和iPhone5模拟器)。

重新安装命令行工具为我解决了这个问题。由于未知原因,Xcode 4.6.3菜单项Xcode-首选项-下载-组件不再有命令行工具,下面是另一种安装方法:

xcode-select --install

--install
          Opens a user interface dialog to request automatic installation of the
          command line developer tools.

现在运行“pod install”工作得很好。

阎经武
2023-03-14

我也看到了。运行此命令修复了以下问题:

sudo gem install cocoapods && pod install
 类似资料: