IOS Learning Cocoapods using __ios

Source: Internet
Author: User
Tags install cocoapods

Stick to the growth of a daily article
Note: The installation of Cocoapods, the use of the process is done under the Mac terminal.

For the introduction of cocoapods here on the omission, there are a lot of introduction Cocoapods Bowen, we can own Baidu. Here directly on step. Cocoapods Installation

1. Update Ruby to the latest version, we enter in the terminal
Gem Update--system
2. To ensure that Ruby has been to the latest version, then you can install Cocoapods, we in the terminal input
sudo gem install Cocoapods
This step needs to wait a few minutes for installation. The result of the output indicates that the installation was successful.

Successfully installed cocoapods-0.36.0
parsing documentation for cocoapods-0.36.0
1 gem installed

Note: If you install successfully, ignore this note. If the second step fails, or is stuck too long, it may be because this step of the installation download by the celestial "wall" blocked. We can download and install Cocoapods by using a ruby image of Taobao by configuring it.

Gem sources--remove https://rubygems.org///
etc and then enter the
gem sources-a http://ruby.taobao.org/
// To verify that your Ruby mirror is and is only Taobao, you can view it with the following command:
gem sources-l
//output as follows
* * Current Sources * * *

http:// ruby.taobao.org/

After the above verification you can perform the normal installation cocoapods. the use of Cocoapods

Note: Use Cocoapods to manage your project, the name of the project must be in English. I do not know what the other version of Xcode is, I use the Xcode6.2, if the use of Chinese will appear all kinds of file loss. As shown in figure

1. Add a Third-party framework using cocoapods We must first determine whether there is a third-party framework, where we can use the search command to query whether Git has the framework

Pod Search Zbar

Two of these messages are intercepted here.

-> Afnetworkactivitylogger (2.0.4) afnetworking 2.0 Extension for network Request Logging
   Pod ' Afnetworkactivitylogger ', ' ~> 2.0.4 '-Homepage:https://github.com/afnetworking/afnetworkactivitylogger -source:https://github.com/afnetworking/afnetworkactivitylogger.git-versions:2.0.4, 2.0.3, 2.0.2, 2.0.1 [master Repo]-> Afnetworkactivitylumberjacklogger (2.0.3) afnetworking 2.0 Extension for network Request Logging with Sup Port of Cocoalumberjack forked from Afnetworkactivitylogger by Matt Thompson pod ' Afnetworkactivitylumberjacklogger ' , ' ~> 2.0.3 '-homepage:https://github.com/sohayb/afnetworkactivitylogger-source:https://github.com/sohayb/ afnetworkactivitylogger.git-versions:2.0.3 [master Repo] 

There may be a search for multiple afnetworking, and we can use Pod to distinguish which library to import.
For example: The pod information for the first one above is as follows
Pod ' Afnetworkactivitylogger ', ' ~> 2.0.4 '
The second pod information is as follows
Pod ' Afnetworkactivitylumberjacklogger ', ' ~> 2.0.3 '
We'll use the first message in a minute.

2. Through the terminal CD to the project file directory

The Cocoapodsdemo here are engineering documents.

Then create a podfile file with vim

Vim Podfile

And then enter vim to edit the file after entering the command

Platform:ios, ' 7.0 '
pod ' afnetworking ', ' ~> 2.0.4 '

What does the first line mean?
The second line represents the imported frame

3. Installation Framework to engineering documents

Pod Install

The output is as follows

Downloading dependencies
installing afnetworking 2.5.1 generating
project
Pods Client Project

[!] Xcode sessions and use ' Cocoaposdemo.xcworkspace ' to this project ' "on.

Note: We do not need to perform pod install for projects that already have podfile, we only have to execute

Here is a copy of the other blogger's article, to give you additional learning
Cocoapods Installation and Use tutorial
Cocoapods a objective-c third party library management tool

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.