本文介绍了无法安装Cocoapods - 项目目录中找不到podfile的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我下载了一个示例项目,以了解如何创建UIPageViewController,我试图实际上分叉该项目并需要添加第三方库。现在,它看起来我的项目中没有.xcworkspace文件。当我尝试安装cocoapods时,我首先运行I downloaded a sample project to learn how to make a UIPageViewController, and I am trying to essentially fork that project and need to add a third-party library. Right now, it does not look like I have a .xcworkspace file in my project. When I try and install the cocoapods, I first run sudo gem install cocoapods - 在特定的项目目录中我的终端sudo gem install cocoapods - in the specific project directory in my terminal pod install - 在同一目录中pod install - in that same directory我在终端项目目录中找不到podfile时收到错误。I am receiving an error in the terminal "No podfile found in the project directory."这是否因为我没有.xcworkspace文件而发生?我是否正确安装了podfile?Is this happening because I don't have a .xcworkspace file? Am I installing the podfile correctly?推荐答案 添加CocoaPods以管理项目中的依赖项的步骤:Steps to add CocoaPods to manage dependencies in your project: sudo gem install cocoapods - >这会将CocoaPods安装为你机器上的一块软件。sudo gem install cocoapods -> This installs CocoaPods as a pieceof software on your machine.转到项目目录的根目录并执行 pod init - > 这将为您的项目添加一个基本Podfile。Go to the root of your project directory and execute pod init ->This will add a base Podfile to your project.通过编辑将此外部依赖项添加到此Podfile中。Add the external dependencies that you have to this Podfile by editing it.运行 pod install 将获取您提到的所有外部依赖项,并将其与项目的 .xcworkspace 文件关联。如果您已经没有,那么将为您生成 .xcworkspace 文件。Run pod install which will fetch all the external dependenciesmentioned by you, and associate it with a .xcworkspace file ofyour project. This .xcworkspace file will be generated for you ifyou already do not have one.从这里开始,您应该使用 .xcworkspace 文件而不是 .xcproject 。From here on, you should use .xcworkspace file instead of .xcproject.target 'MyApp' dopod 'AFNetworking', '~> 3.0'end其中 AFNetworking 是pod, 3.0 是我要安装的特定版本。Where AFNetworking is the pod and 3.0 is the specific version that I want to install.文档:使用CocoaPods 这篇关于无法安装Cocoapods - 项目目录中找不到podfile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
05-28 00:09
查看更多