我参考了许多链接并尝试了,但我没有成功。我阅读了CocoaPods文档,并多次尝试安装,但总是因为初始步骤而失败。我发现了一个错误,我不能先安装宝石。一个一个的步骤是什么?例如如何安装的步骤或演示。

这是我尝试过的一个链接。

截图指的是我得到的这个控制台错误:


当前回答

苹果Silicon Mac

$ sudo gem uninstall ffi && sudo gem install ffi -- --enable-libffi-alloc

其他回答

这里是一个图像的所有步骤。请按照它正确,我相信你不会得到任何错误。

从如何安装CocoaPods和设置你的Xcode项目。


首先,检查是否必须安装命令行。

你可以打开Xcode,在菜单中导航到 Xcode→首选项→下载→组件。找到命令行工具并选择安装/更新。

如果你没有找到命令行工具,那么你需要在终端上写这个命令:

xcode-select --install

然后点击安装。

如果你已经安装了命令行工具,你需要选择你的Xcode目录(有时这些类型的问题是由于可用的Xcode版本不同造成的)

遵循这个步骤。

打开终端,执行如下命令: Sudo gem安装cocoapods 输入“admin”密码。这可能需要一段时间。几分钟后,它 将显示绿色信息,如果CocoaPods成功安装在您的 Mac机。 如果你在Xcode 6中出现任何错误,比如开发者路径 失踪。首先在终端运行这个命令: sudo xcode-select -switch /Applications/Xcode6。app(或你的XCodeName.app) 现在你可以用你的Xcode项目设置Pod了。

现在你必须安装吊舱。遵循这个步骤。

打开终端 更改目录到您的Xcode项目根目录(其中您的 ProjectName。放置Xcodeproj文件)。 pod设置:(设置CocoaPods主库) 如果成功,将显示:安装完成(只读访问)。所以, 一切都是你安排的。现在让我们做一些更明显的事情。让我们在Xcode项目中安装库。

现在你必须在你的项目中设置和更新与pod相关的库。

Steps to add-remove-update libraries in pod: Open Terminal Change directory to your Xcode project root directory. If your terminal is already running then there isn't any need to do this, as you are already at the same path. touch pod file open -e podfile (This should open a blank text file) Add your library names in that text file. You can add new names (library name), remove any name or change the version, e.g.: pod ’Facebook-iOS-SDK’ pod ’EGOTableViewPullRefresh’ pod ’JSONKit’ pod ‘MBProgressHUD NOTE: Use the (control + ”) button to add single quote at both end of library name. It should be shown as straight vertical line. Without control button it shall be added as curly single quote which will give error while installation of file. Save and close this text file. Now libraries are set up and you have to install/update it Go to your terminal again and run this command: pod install (to install/update these libraries in pod). You should see output similar to the following: Updating spec repo `master’ \ Installing Facebook-iOS-SDK \ Generating support files

设置完成。

注意:

如果你正确地一步一步地遵循了这整个过程,那么你可以在选择Xcode后直接触发pod更新命令,然后选择你的项目路径。并编写命令荚更新。

你也可以在这里检查命令行工具:

打开终端 如果你没有cocoapods,输入sudo gem install cocoapods 输入“cd /工程路径”,但要替换为实际工程路径 触摸podfile 使用以下命令之一打开podfile: open -e podfile以TextEdit或 在Xcode中打开pod文件 设置目标并添加GoogleMaps pod文件,如下所示: 目标“项目名称在这里”做 豆荚的GoogleMaps 结束 使用pod install来安装依赖项

2020年,在macOS v10.15 (Catalina)中安装CocoaPods v1.9.1

首先在Mac上使用终端设置Xcode版本。 sudo xcode-select -switch /Applications/Xcode.app 接下来,使用终端安装CocoaPods。 Sudo gem安装cocoapods

更多信息,请访问官方网站https://cocoapods.org/。

Mac OS X v10.11 (El captain)

RVM安装ruby-2.2.2

RVM使用ruby-2.2.2。

Sudo gem install -n /usr/local/bin cocoapods . sh

Pod文件安装步骤

sudo gem install -n /usr/local/bin cocoapods

舱设置

cd ~/Path/To/Folder/Containing/ShowTracker

touch podfile
open -a Xcode Podfile // To open it in Xcode
OPEN -e podfile       // To open it in text editor
pod install           // To install a new pod
pod update            // To update all pods