iOS development: Cocoapods a objective-c third party library management tool

Source: Internet
Author: User
Tags install cocoapods

1, Cocoapods is running in Ruby software, installation may take several minutes, install named:

sudo gem install Cocoapods

2, if you want to generate documents for each third party library, run

The Brew install Appledoc This step is optional.

After the installation is complete, prompt:

If your ruby environment is not new, you may want to update it:

Gem Update--system

Now pod is installed, how to use it?

Search

First try the search function, what library you need, you can use pod to search, such as to use Jsonkit this library:

Pod Search is named after the name of the library.

Pod Search Jsonkit

Search out:

Class

OK, in the end Shell CD comes to the project you want to manage, run: Pod install

After running, you will find that your project directory is like this:

More *.xcworkspace pod and other documents. This is the pod-generated project management file that opens the Libdemo.xcworkspace project file, which is seen in Xcode as a directory structure:

To add a library:

Vim Podfile Open the file and add the Jsonkit just to the search.

Platform:ios

Pod ' Jsonkit '

Save exit.

Running: Pod update

This is the Jsonkit library download and associated with the local project, this is Xcode prompts you to update the project

Dot revert.

At this time you look at the Project pod section, more Jsonkit library. Well, the third party library is so magical to add in.

Header file path

Then try to use JONSKit.h, in VIEWCONTROLLER.M quote. Can't find the end file, what to do? The directory of the header file has not been set up in the target of the project:

As shown in the following figure, enter ${srcroot} and select Recursive.

In the reference header file:

Perfect.

Other third party libraries.

Podfile file is added after pod update OK.

Platform:ios, ' 5.0 '

Pod ' Jsonkit '

Pod ' afnetworking '

Pod ' Mbprogresshud '

Pod ' reachability '

Pod ' Nimbus/core '

For example, I quote the above library, Nimbus is too big, I only need Core, also can write this.

Cocoapods also has many advanced features that can be used on demand.

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.