如何在Podfile中选择项目?我收到错误:无法找到目标'Pods'的Xcode项目

meg*_*n66 38 xcode ios cocoapods

我正在做Ray Wenderlich教程,名为SimpleWeather.
podfile与项目位于同一文件夹中.这是podfile中的代码:

platform :ios, '7.0'

xcodeproj 'SimpleWeather'  

pod 'Mantle'  
pod 'LBBlurredImage'  
pod 'TSMessages'  
pod 'ReactiveCocoa'  
Run Code Online (Sandbox Code Playgroud)

错误消息是这样的:[!]无法找到/Users/myName/Developer/SimpleWeather.xcodeproj目标的Xcode项目Pods.

该项目的名称是SimpleWeather.

fah*_*ahu 59

我很确定你不在正确的目录中.你确定你.xcodeproj在Developer文件夹中吗?您可能需要导航到的子文件夹.

在项目中启用CocoaPods的正确方法是:

  1. 打开终端并执行: $ sudo gem install cocoapods
  2. 导航到您的项目文件夹(我假设你的情况cd /Users/myName/Developer/SimpleWeather/SimpleWeather.xcodeproj).
  3. 设置Cocoapod pod setup
  4. 创建Podfile touch Podfile
  5. 打开Podfile open -e Podfile并插入Podfile 的代码
  6. 最后安装Podfile pod install

如果您遵循此说明,一切都应该有效.打开项目时,请确保打开.xworkspace文件.

有关更多信息,请参阅此内容.

  • 嘿它给了我这样的"[!] [!] Podfile不包含任何依赖项." (2认同)

Bri*_*ian 31

当您.xcodeproj的Xcode项目中有多个时,也会发生此错误.

.xcodeproj在一般情况下,您不需要多个.删除不必要的.xcodeproj,之后Cocoapods会自动获得正确的路径.


kuk*_*ido 20

重申我们原来的对话:

根据Podfile语法参考,Podfile看起来正确.

确保$pod install从项目目录运行:

/Users/myName/Developer/SimpleWeather
Run Code Online (Sandbox Code Playgroud)


Roh*_*ale 14

嘿,你的项目路径可能是错的.转到项目并右键单击SimpleWeather.xcodeproj并选择获取信息如下图所示(右侧窗口用于获取此处的信息).从详细信息窗口复制此路径并将其粘贴到Podfile中.之后将/SimpleWeather.xcodeproj附加到该粘贴的路径.这可能会解决问题(注意:这是我项目的快照).在你的情况下,解决方案可能是用这个/Users/myName/Developer/SimpleWeather/SimpleWeather.xcodeproj替换路径

在此输入图像描述