xcode Cocoapods:“没有找到Xcode项目,请指定一个!”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/44341559/
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-09-15 10:00:23  来源:igfitidea点击:

Cocoapods: "No Xcode project found, please specify one!"

xcodecocoapods

提问by Carl Henretti

Cocoapods is giving me this error message when calling pod init:

Cocoapods 在调用时给我这个错误信息pod init

[!] No Xcode project found, please specify one

I've...

我有...

  1. called sudo gem install cocoapodsand waited for it to install
  2. dragged in my project directory folder "Hello" (see images)
  3. called pod init
  1. 调用sudo gem install cocoapods并等待它安装
  2. 拖入我的项目目录文件夹“Hello”(见图)
  3. pod init

Here's my desktop:

这是我的桌面:

What my directory folder "Hello looks like (sudo gem install cocoapods has already finished

我的目录文件夹“你好”的样子(sudo gem install cocoapods 已经完成

What happens when I try to initialize the pod.

当我尝试初始化 pod 时会发生什么。

Why does that happen?

为什么会这样?

回答by Nirav

Just close the XCode and terminal once then restart the Terminal. Make sure you select the path to your project folder only.

只需关闭 XCode 和终端一次,然后重新启动终端。确保仅选择项目文件夹的路径。

After calling cd /Users/YOUR_USER_NAME/Desktop/PROJECT_NAMEjust call a command ~lsand check if the list of the file contains your PROJECT_NAME.xcodeproj. If this file is available, it means you can now set up pod init. Otherwise, you should navigate to the next level and find your PROJECT_NAME.xcodeproj.

调用后cd /Users/YOUR_USER_NAME/Desktop/PROJECT_NAME只需调用命令~ls并检查文件列表是否包含您的 PROJECT_NAME.xcodeproj。如果此文件可用,则表示您现在可以设置pod init. 否则,您应该导航到下一个级别并找到您的 PROJECT_NAME.xcodeproj。

Hope it helps! :)

希望能帮助到你!:)

回答by Govan

if you are using REACT NATIVE ,make sure go to ios folder ,then pod init

如果您使用的是 REACT NATIVE,请确保转到 ios 文件夹,然后 pod init

回答by u11377092

My solution:

我的解决方案:

  1. called sudo gem install cocoapods and waited for it to install
  2. pod setup
  3. dragged in my project directory folder "Hello"
  4. called pod init
  1. 调用 sudo gem install cocoapods 并等待它安装
  2. 吊舱设置
  3. 拖到我的项目目录文件夹“你好”
  4. 称为 pod init

https://www.jianshu.com/p/a3b803457b08

https://www.jianshu.com/p/a3b803457b08

It's working for me.

它对我有用。

回答by Carl Henretti

My solution:

我的解决方案:

Using terminal would still not work, so I just used the official Cocoapods application and it worked fine. Just download it, select new podfile and then your project and you're ready to go!

使用终端仍然不起作用,所以我只使用了官方的 Cocoapods 应用程序,它运行良好。只需下载它,选择新的 podfile,然后选择你的项目,你就可以开始了!

回答by Mo Iisa

Make sure that you are in the correct directory where you .xcodeproj is located.

确保您位于 .xcodeproj 所在的正确目录中。

回答by Ben

I had the same issue and the problem was because of the space in the directory name. I could see on the Desktop there was no space in the directory name, but in Finder, there was a space in the name. After closing out of XCode and then renaming the folder to have no spaces the issue was solved and 'pod init' worked fine.

我遇到了同样的问题,问题是因为目录名称中有空格。我可以在桌面上看到目录名称中没有空格,但在 Finder 中,名称中有一个空格。关闭 XCode,然后将文件夹重命名为没有空格后,问题就解决了,“pod init”运行良好。

回答by John

Might as well add my 2 cents. I just installed xcode and react native, following this guide: https://dev.to/rob117/how-to-really-set-up-a-react-native-environment-on-mac-248h

不妨加上我的 2 美分。我刚刚安装了 xcode 并按照本指南进行了本机反应:https: //dev.to/rob117/how-to-really-set-up-a-react-native-environment-on-mac-248h

Everything seemed to run as expected at first with react-native run-ios...I copied over some react-native files from another project, got some dependency errors, fixed them with npm install, and then I restarted my MacBook. After I booted up again, I ran react-native run-iosand got errors about not being able to launch the iPhone 6 simulator. I couldn't find a fix, so I decided to determine if it was my code or if it was xcode or what. So I went to my main projects directory and started a new react-native project, referencing the link I posted above. After everything installed, I did react-native run-iosagain and boom, everything worked fine.

起初一切似乎都按预期运行react-native run-ios......我从另一个项目复制了一些 react-native 文件,得到了一些依赖错误,用 npm install 修复了它们,然后我重新启动了我的 MacBook。再次启动后,我运行react-native run-ios并收到有关无法启动 iPhone 6 模拟器的错误。我找不到修复程序,所以我决定确定它是我的代码还是 xcode 或什么。所以我转到我的主项目目录并开始一个新的 react-native 项目,参考我上面发布的链接。一切都安装好后,我又做了react-native run-ios一次,轰隆隆,一切正常。

So then I closed xcode, the simulator and the terminal that runs upon starting react-native. I went back to my first project and ran react-native run-ios. boom it's working again, except this strange error error Could not find the following native modules: RNKeychain, RNVectorIcons. Did you forget to run "pod install" ?. I installed cocoapods via brew the first time around, I tried pod installbut it complains about no xcode file or something. I've tried pod init, but it tells me No Xcode project found, please specify one. I ran pod setup, no error...seemed to do nothing? I guess it's working because now my simulator is running again.

然后我关闭了 xcode、模拟器和在启动 react-native 时运行的终端。我回到我的第一个项目并运行react-native run-ios. 繁荣它再次工作,除了这个奇怪的错误error Could not find the following native modules: RNKeychain, RNVectorIcons. Did you forget to run "pod install" ?。我第一次通过 brew 安装了 cocoapods,我尝试过,pod install但它抱怨没有 xcode 文件或其他东西。我试过 pod init,但它告诉我No Xcode project found, please specify one. 我跑了pod setup,没有错误...似乎什么也没做?我想它正在工作,因为现在我的模拟器又开始运行了。

Maybe I'll just remove the react-native-keychain and react-native-vectoricons npm packages from my package.json and see if it goes away. I don't really understand what coca pods is or why I need it. I'm thinking maybe you should take some time to update xcode, delete node_modules folder and run npm installagain, spin up a new react-native project and if it works close xocde, simulator and the terminal and then try to go run your project again.

也许我会从我的 package.json 中删除 react-native-keychain 和 react-native-vectoricons npm 包,看看它是否消失。我真的不明白古柯豆是什么或者我为什么需要它。我在想也许你应该花一些时间更新 xcode,删除 node_modules 文件夹并npm install再次运行,启动一个新的 react-native 项目,如果它可以关闭 xocde、模拟器和终端,然后尝试再次运行你的项目。

If it was working fine before and you didn't update anything outside of node_modules folder, remove and reinstall often works for me.

如果它之前工作正常并且您没有更新 node_modules 文件夹之外的任何内容,则删除并重新安装通常对我有用。

Good luck

祝你好运

回答by Tauqeer Hassan

Rename the projectFolder to 7, Project folder should have the same name as the .xcodeprojfile has.

将 projectFolder 重命名为 7,Project 文件夹应与.xcodeproj文件同名。

回答by Abhishek Mishra

It's working for me .

它对我有用。

first import directory in terminal where your .xcodeproj.

在终端中的第一个导入目录,您的.xcodeproj.

then run pod initit's showing error ([!] No Xcode project found, please specify one)...then run pod installcommand .. Again it is showing error ([!] NoPodfile' found in the project directory.)`..

然后运行pod init它显示错误([!] No Xcode project found, please specify one)......然后运行pod install命令..它再次显示([!] No在项目目录中找到的错误Podfile'。)`..

then QUIT terminal .. Open again ...

然后退出终端..再次打开......

import directoryin terminal again Run command pod init..

import directory再次在终端运行命令pod init..

Now working fine.

现在工作正常。