CocoaPods: A objective-c management tool for third-party libraries

Source: Internet
Author: User
Tags install cocoapods

CocoaPods: A objective-c management tool for third-party libraries

Introduced:

Third-party libraries are indispensable when developing applications, which can improve the efficiency of development. Some frequently used libraries, in the new project with IS, you have to manually add to the project, with the library more up, it is not easy to manage. Cocoapods This software, you can easily help you manage the third-party libraries in Xcode.

How does that work? Install Cocoapods first.

1, Cocoapods is running in Ruby software, installation may take a few minutes, install named: sudo gem install cocoapods

2. If you want to generate a document for each third-party library, running the Brew install Appledoc is optional.

Prompt when installation is complete:

If your ruby environment is not new, you might want to update the gem Update--system

Now pod is installed, how to use it?

Search

First try the search function, what library you need, you can use the pod to search, such as to use Jsonkit this library: Pod Search is the name of the searches, after the library names are written on the line. Search for pod search Jsonkit

Search out:

Initialization

Okay, in the terminal shell CD comes to the project you want to manage, run: Pod install

When you're done, you'll find something like this in your project directory:

More *.xcworkspace pods and other files. This is the project management file that pod generates, open the Libdemo.xcworkspace project file, and see in Xcode the directory structure:

Add a library:

Vim Podfile Open the file and add the jsonkit you just searched for.

Platform:ios

Pod ' Jsonkit '

Save exit.

Run: Pod update

This is to download the Jsonkit library and associate it with the local project, which is Xcode prompting you to update the project.

Point revert.

At this point you look at the pod section of the project, more Jsonkit library. Well, third-party libraries are so magical to add in.

Header file path

Then try using JONSKit.h, quoted in the VIEWCONTROLLER.M. Can not find the head file, how to do? Do not set the header file directory, set the target in the project:

As shown, select recursive after entering ${srcroot}.

Reference header file:

Other third-party libraries

The Podfile file is added after pod update is OK.

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

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

Reference: Https://github.com/CocoaPods/CocoaPods/wiki

Source: http://blog.csdn.net/totogo2010/article/details/8198694


CocoaPods: A objective-c management tool for third-party libraries

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.