"Turn" cocoapods a management tool for objective-c third-party libraries

Source: Internet
Author: User
Tags install cocoapods

Original URL: http://blog.csdn.net/totogo2010/article/details/8198694

Introduced:

Third-party libraries are indispensable when developing applications and 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. Discover cocoapods This software, can help you to manage the third party's library in Xcode, very convenient.

How does that work? Install Cocoapods first.

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

sudo gem install Cocoapods

2. If you want to generate a document for each third-party library, run

Brew Install Appledoc This step is optional.

Prompt when installation is complete:

If your ruby environment is not new, you might 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 the pod to search, such as to use Jsonkit this library:

The pod search is named after the name of the library.

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}.

In the reference header file:

Perfect.

Other third-party libraries.

The Podfile file is added after pod update is OK.

[HTML]View PlainCopy
    1. Platform:ios, ' 5.0 '
    2. Pod ' Jsonkit '
    3. Pod ' afnetworking '
    4. Pod ' Mbprogresshud '
    5. Pod ' reachability '
    6. Pod ' Nimbus/core '


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

Cocoapods also has a lot of advanced features that can be used on demand.

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

Jongfangzhi (http://blog.csdn.net/totogo2010)

This article follows "Attribution-non-commercial use-consistent" authoring public agreement

"Turn" cocoapods a management tool for objective-c 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.