我参考了许多链接并尝试了,但我没有成功。我阅读了CocoaPods文档,并多次尝试安装,但总是因为初始步骤而失败。我发现了一个错误,我不能先安装宝石。一个一个的步骤是什么?例如如何安装的步骤或演示。
这是我尝试过的一个链接。
截图指的是我得到的这个控制台错误:
我参考了许多链接并尝试了,但我没有成功。我阅读了CocoaPods文档,并多次尝试安装,但总是因为初始步骤而失败。我发现了一个错误,我不能先安装宝石。一个一个的步骤是什么?例如如何安装的步骤或演示。
这是我尝试过的一个链接。
截图指的是我得到的这个控制台错误:
当前回答
检查这个
gem install -p http://proxy_ip:proxy_port compass
你可能需要添加你的用户名和密码:
gem install -p http://[username]:[password]@proxy_ip:proxy_port compass
检查这个链接,它可能会帮助你。
其他回答
安装pod文件的简单步骤:
打开终端 终端命令:sudo gem install cocoapods 在终端中设置项目路径。 命令:pod init 转到项目的pod文件,并添加要安装的pod 添加到pod文件:pod 'AFNetworking', '~> 3.0 . 命令:Pod install 关闭Xcode项目 从终端打开项目 命令:打开PodDemos.xcworkspace
这些是我通常遵循的完整步骤。我把这些步骤写得尽可能短,假设你了解Mac和Xcode项目。首先,打开终端,使用以下命令,每个命令后按enter键。
如果你还没有安装CocoaPods,输入以下命令:
sudo gem install cocoapods
现在请使用以下命令移动到您的Xcode项目目录,并将/您的Xcode项目目录路径替换为该目录的实际路径:
cd /Your Xcode Project Directory Path
下面是如何使用CocoaPods的说明。输入到终端的每个命令执行成功后,请等待一段时间。
Searching for pods in terminal: pod search networking (replace networking with which you want to search) Creating the pod file: pod init Opening the pod file: open -a Xcode Podfile Adding the pods: (After adding your pods you must save the podfile first and then head back to the terminal again.) target 'WebServiceUsingMantleAFNetworking' do # platform :ios, '8.0' //Choose your version of iOS pod 'AFNetworking', '~> 2.6.0’ end OR platform :ios, '8.0' pod 'AFNetworking' pod 'Mantle' pod 'LBBlurredImage' pod 'TSMessages' pod 'ReactiveCocoa' Installing the pods: pod install Check for updates of pods on existing project: pod outdated Update the existing pods: pod update Uninstall the Cocoapods from system: sudo gem uninstall cocoapods There is a complete tutorial for removing pods from your Xcode project on Stack Overflow. You can check on this following link for more info. How to remove CocoaPods from a project?
在macOS v10.14 (Mojave)和Xcode 10.3上,我收到了来自gem路由的可怕警告,无论是否使用-n /usr/local/bin:
xcodeproj's executable "xcodeproj" conflicts with /usr/local/bin/xcodeproj
Overwrite the executable? [yN]
对我来说有用的仍然是Homebrew。只是:
brew install cocoapods
对于终端中的CocoaPods,请遵循以下命令:
sudo gem update
sudo gem install cocoapods
pod setup
cd (project direct drag link)
pod init
open -aXcode podfile # (If it’s already open, add your pod file name. Example: alamofire4.3)
pod install
pod update
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