我参考了许多链接并尝试了,但我没有成功。我阅读了CocoaPods文档,并多次尝试安装,但总是因为初始步骤而失败。我发现了一个错误,我不能先安装宝石。一个一个的步骤是什么?例如如何安装的步骤或演示。
这是我尝试过的一个链接。
截图指的是我得到的这个控制台错误:
我参考了许多链接并尝试了,但我没有成功。我阅读了CocoaPods文档,并多次尝试安装,但总是因为初始步骤而失败。我发现了一个错误,我不能先安装宝石。一个一个的步骤是什么?例如如何安装的步骤或演示。
这是我尝试过的一个链接。
截图指的是我得到的这个控制台错误:
当前回答
多亏了SwiftBoy的10步解决方案,我成功地使用CocoaPods设置了最新版本的AudioKit。
1. 使用Xcode创建MyAudioApp Swift项目,将其保存到我的开发者目录。
/Users/me/Developer/MyAudioApp
2. 使用Cocoapods在MyAudioApp项目中安装AudioKit(即安装AudioKit sdk)
3.打开终端,键入下面的命令并按Enter
sudo gem install -n /usr/local/bin cocoapods
4. 输入系统密码,按“Enter”
5. 在终端中,键入下面的命令并按Enter
cd /Users/me/Developer/MyAudioApp
6. 在下面的终端类型命令中创建项目pod文件并按Enter
touch Podfile
7. 在下面的终端类型命令中打开项目pod文件并按Enter(在TextEdit中打开)
open Podfile
8. 编辑下面的代码到打开的pod文件(并在退出TextEdit之前保存文件)
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '12.2'
use_frameworks!
target 'MyAudioApp' do
pod 'AudioKit', '~> 4.7'
end
9. 在下面的MyAudioApp工作空间类型Terminal命令中安装AudioKit并按Enter
Pod install
等待安装完成
10. 在Finder中,进入项目文件夹/Users/me/Developer/MyAudioApp 然后点击下面的。xcworkspace文件(在Xcode中打开!)
/Users/me/Developer/MyAudioApp/MyAudioApp.xcworkspace
11. 在MyAudioApp中编辑ViewController.swift并插入以下内容
import AudioKit
其他回答
通常我们使用
sudo gem install cocoapods
解决方案,修复CocoaPods错误在Mac OS X v10.11 (El Capitan):
sudo gem install -n /usr/local/bin cocoapods
pod setup
cd /project path
pod init
在Podfile中,我们需要设置目标
# Podfile
platform :ios, '9.0'
use_frameworks!
# My other pods
target “Projectname” do
pod 'MBProgressHUD', '~> 0.8'
pod 'Reachability', '~> 3.1.1'
pod 'AFNetworking', '~> 2.2'
pod 'TPKeyboardAvoiding', '~> 1.2'
end
target 'ProjectnameTests' do
testing_pods
end
target 'ProjectnameUITests' do
testing_pods
end
在控制台终端
pod install
在mac M1上 我安装了两个cocoapods,一个用的是啤酒,一个用的是宝石。有两个不同的版本。 在看了你的很多帖子,尝试了很多事情之后,我遇到了各种各样的麻烦。
最后,这一点帮助了我:感谢Evan
他的帖子:https://stackoverflow.com/a/70600723/2355088
对我来说,最后的工作顺序可能是:
Sudo宝石卸载cocoapods 酿造卸载cocoapods 酿造安装椰荚 酿造重新安装红宝石 重启所有条款<=神奇的一步,谢谢你埃文 cd myProj 圆荚体安装
你可以在macOS中通过Homebrew安装CocoaPods。
首先,打开您的终端,并运行以下代码(如果没有安装Homebrew,则用于安装):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
然后通过以下命令轻松安装CocoaPods:
brew install cocoapods
容器安装
Open terminal and type: sudo gem install cocoapods The Gem will get installed in Ruby inside the System library. Or try on Mac OS X v10.11 (El Capitan), type: sudo gem install -n /usr/local/bin cocoapods If there is an error "activesupport requires Ruby version >= 2.xx", then install latest activesupport first by typing in the terminal. sudo gem install activesupport -v 4.2.6 After installation, there will be a lot of messages. Read them and if no error found, it means the CocoaPods installation is done. Next, you need to setup the CocoaPods master repository. Type in the terminal: pod setup And wait it will download the master repository. The size is very big (370.0 MB in December 2016). So it can be a while. You can track of the download by opening Activity and go to the Network tab and search for "git-remote-https". Alternatively, you can try adding "--verbose" to the command like so: pod setup --verbose Once done, it will output "Setup Complete", and you can create your Xcode project and save it. Then in the terminal, cd to your Xcode project root directory (where your .xcodeproj file resides) and type: pod init Then open your project's podfile by typing in terminal: open -a Xcode Podfile Your Podfile will get open in text mode. Initially there will be some default commands in there. Here is where you add your project's dependencies. For example, in the podfile, type pod 'AFNetworking', '0.9.1' (This line is an example of adding the AFNetworking library to your project.) Other tips: Uncomment platform :ios, '9.0' Uncomment use_frameworks! if you're using Swift When you are done editing the podfile, save it and close Xcode. Then install pods into your project by typing in terminal: pod install or (For m1 chip) arch -x86_64 pod install Depending how many libraries you added to your podfile for your project, the time to complete this varies. Once completed, there will be a message that says "Pod installation complete! There are X dependencies from the Podfile and X total pods installed." Now close your Xcode project. Then locate and open the .xcworkspace Xcode project file and start coding. (You should no longer open the xcodeproj file.)
在macOS大苏尔工作
安装最新版本的brew (https://treehouse.github.io/installation-guides/mac/homebrew)
2 .然后使用“brew uninstall cocoapods”
3使用“brew install cocoapods”安装最新版本的cocoapods(你必须用github version https://github.com/CocoaPods/CocoaPods/releases/tag/1.11.2验证安装版本,它们必须匹配)
4 .用“brew link—overwrite cocoapods”覆盖cocoapods链接
5 .查看cocoapods的版本“pod——version”
你已经安装了最新版本的cocoapods