如何安装cocoapods? [英] How to install cocoapods?
问题描述
这个是我试过的一个链接。
屏幕截图指的是我给出的这个控制台错误:
POD安装
打开终端并键入:
sudo gem install cocoapods
Gem将安装在系统库中的Ruby。或者试试10.11 Mac OSX El Capitan,请输入:
sudo gem install -n / usr / local / bin cocoapods
如果出现主动支持需要Ruby版本> = 2.xx的错误,请先安装最新的主动支持在终端。
sudo gem install activesupport -v 4.2.6
[2]安装完成后,会有很多消息,读取它们,如果没有发现错误,则意味着cocoapods安装完成。接下来,你需要安装cocoapods master repo。输入终端:
pod setup
等待它将下载主回购。大小非常大(2016年12月为370.0MB)。所以它可能会有一段时间。您可以通过打开活动并转到网络选项卡并搜索git-remote-https来跟踪下载。或者,您可以尝试在命令中添加详细信息,如下所示:
pod setup --verbose
[3]一旦完成,它将输出Setup Complete,您可以创建XCode项目并将其保存。
[ 4]然后在终端cd到您的XCode项目根目录(您的.xcodeproj文件所在的位置)并输入:
$ b pod init
然后通过在终端中输入你的项目的podfile:
open -a Xcode Podfile
[6]您的Podfile将以文本模式打开。最初会有一些默认命令。这是您添加项目依赖关系的地方。例如,在podfile中,键入
pod'AFNetworking','0.9.1'
(这一行是将AFNetworking库添加到您的项目中的一个示例)。
其他提示:
取消注释 platform:ios,'9.0'
取消注释 user_frameworks!
如果您使用的是Swift
当您完成编辑podfile后,保存它并关闭XCode。
然后在终端中输入pod到你的项目中:
b$ b
取决于为您的项目添加到您的pod文件的库数量,完成此操作的时间会有所不同。一旦完成,就会出现一条消息:
Pod安装完成!Podfile中存在X依赖关系
和X
现在关闭您的xcode项目并打开.xcworkspace xcode项目文件并开始编码。 :)
I referred too many links and tried, but had no success. If any one has an idea then please please share with me. I read cocoa pods documents and many times tried to install but always failed because of the starting steps. I found one error whereby I can't install gems first. Can anyone give me the steps one by one? How to install or demo.
This is one link which I tried.
The screen shot refers to this console error I was given:
POD Install
[ 1 ] Open terminal and type:
sudo gem install cocoapods
Gem will get installed in Ruby inside System library. Or try on 10.11 Mac OSX 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 terminal.
sudo gem install activesupport -v 4.2.6
[ 2 ] After installation, there will be a lot of messages, read them and if no error found, it means cocoapods installation is done. Next, you need to setup the cocoapods master repo. Type in terminal:
pod setup
And wait it will download the master repo. The size is very big (370.0MB at Dec 2016). So it can be a while. You can track of the download by opening Activity and goto Network tab and search for git-remote-https. Alternatively you can try adding verbose to the command like so:
pod setup --verbose
[ 3 ] Once done it will output "Setup Complete", and you can create your XCode project and save it.
[ 4 ] Then in terminal cd to "your XCode project root directory" (where your .xcodeproj file resides) and type:
pod init
[ 5 ] Then open your project's podfile by typing in terminal:
open -a Xcode Podfile
[ 6 ] 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 user_frameworks!
if you're using Swift
When you are done editing the podfile, save it and close XCode.
[ 7 ] Then install pods into your project by typing in terminal:
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 and open .xcworkspace xcode project file and start coding. :)
这篇关于如何安装cocoapods?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!