ios 无法自动选择 Xcode 项目

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/37908339/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 09:27:52  来源:igfitidea点击:

Could not automatically select an Xcode project

iosxcodecocoapodsxcode7

提问by kvra13

When i type "pod install" in a correct directory I always get this

当我在正确的目录中键入“pod install”时,我总是得到这个

Analyzing dependencies

分析依赖

[!] Could not automatically select an Xcode project. Specify one in your Podfile like so:

    project 'path/to/Project.xcodeproj'

podfile

播客文件

platform :ios, '8.0'
use_frameworks!

target 'Posting' do
pod 'ALCameraViewController'

end

I'm in the project directory where Podfile can be found.

我在可以找到 Podfile 的项目目录中。

回答by ullstrm

I had an old .xcodeproj-file in my folder, so there was 2 of them. I removed the old one and it works!

我的文件夹中有一个旧的 .xcodeproj 文件,所以有 2 个。我删除了旧的,它可以工作!

回答by torun

Add your Podfile to project line for Specify project path

将您的 Podfile 添加到项目行以指定项目路径

target 'MyGPSApp' do
  project 'FastGPS'
  ...
end

details: https://guides.cocoapods.org/syntax/podfile.html#project

详情:https: //guides.cocoapods.org/syntax/podfile.html#project

回答by Sharukh Mastan

This happened to me, I had my "podfile" in the subfolder and not the main directory, e.g., ~/MyProject/MyProject/podfile instead of ~/Myproject/podfile

这发生在我身上,我在子文件夹而不是主目录中有我的“podfile”,例如 ~/MyProject/MyProject/podfile 而不是 ~/Myproject/podfile

Hope this helps!

希望这可以帮助!

回答by dllnboy

platform :iOS, '8.0'
use_frameworks!

target 'Posting' do
project 'projectpath/project.xcodeproj'
pod 'ALCameraViewController'
end

回答by Arjun Kava

It is taking single declaration for each target. Add line at top of the file after platform:

它对每个目标进行单一声明。在平台之后的文件顶部添加行:

project '<Project>.xcodeproj'

target '<Project>' do
 #bla bla bla
end

target '<Project>-tvOS' do
 #bla bla bla
end

回答by SylvesterAbreuLoreto

To address this, you'll need to add the correct path to your project.xcodeproj. Having this one fixed, It's very likely you'll need to provide the path to your project.xcworkspace. The code below addresses both issues.

要解决此问题,您需要将正确的路径添加到project.xcodeproj. 修复此问题后,您很可能需要提供project.xcworkspace. 下面的代码解决了这两个问题。

target 'your-app-bundle-name' do

platform :ios, '8.0'
workspace 'path/to/your/project.xcworkspace/'
project 'path/to/your/project.xcodeproj/'

pod 'ALCameraViewController'

end

回答by Adobels

I have got this error when I have moved my repo to an external drive.

当我将我的 repo 移动到外部驱动器时,我遇到了这个错误。

My solution was to move the repository to the main drive.

我的解决方案是将存储库移动到主驱动器。

回答by JiteshW

I had 2 files with .xcodeprojalong with 1 .xcworkspace, inside my project folder. I deleted one and problem got resolved.

我的项目文件夹中有 2 个文件和.xcodeproj1 个.xcworkspace文件。我删除了一个,问题解决了。

In my case, I removed the one whose size was zero bytes.

就我而言,我删除了大小为零字节的那个。

回答by yeahdixon

Oddly I had 2 .xcodeproj files in the same directory . I think i duplicated one. It showed up in the workspace as red, When I removed one it worked fine .

奇怪的是,我在同一目录中有 2 个 .xcodeproj 文件。我想我复制了一个。它在工作区中显示为红色,当我删除一个时它工作正常。

回答by vengleab so

You should specific project path inside pod file

您应该在 pod 文件中指定项目路径

platform :ios, '8.0'
   use_frameworks!

   project 'PATH_TO_PROJECT/YOUR_PROJECT_NAME.xcodeproj'
    target 'Posting' do
    pod 'ALCameraViewController'

end