An Introduction to iOS program dependency management tools Cocoapods

Source: Internet
Author: User
Tags exit json install cocoapods

1. Introduction

Cocoapods is a tool responsible for managing third party Open-source code in the iOS project, and its source is open source on GitHub. Using Cocoapods can save time and increase productivity by setting up and updating Third-party open source libraries.

2. Installation and use of Cocoapods

2.1 Installation

In the terminal, enter the following two commands sequentially:

sudo gem install Cocoapods

Pod Setup

2.2 Use

2.2.1 Basic use

1 Create a new project in Xcode, such as Podsdemo, and exit Xcode after the creation is complete. Open the terminal and the CD enters the directory where the folder is located

2) Create a configuration file

VI Podfile

Enter something like the following:

Platform:ios, ' 7.0 '
Pod ' afnetworking '

In addition to the Afnetworking framework added in the configuration file, the minimum version of the iOS project run is specified

3) Input: Wq Save Exit VI

4) Install Pod

Pod Install

5 in the Finder double hit Open podsdemo.xcworkspace can

Tip: In Xcode, #import头文件时, as follows:

#import <AFNetworking.h>

Other features of 2.2.2 Cocoapods

1) Find third Party library

Pod Search JSON

This command can search the full name of a Third-party library, or you can enter related keywords, such as pod search JSON

2 Update references to third party libraries

Open the Podfile configuration file, add or remove the Third-party library references in the configuration file, and after you save the exit, run:

Pod Update

Or

Pod Install

You can update your project's references to Third-party libraries.

For further information on the use of Cocoapods, you can visit the official website: http://docs.cocoapods.org/guides/getting_started.html
3. Common GEM commands
3.1 Add the source of the gem (why add you know, thanks to the old horse)

Gem Sources-a http://ruby.taobao.org/

3.2 View gem sources

Gem Sources–l

3.3 Gem Self upgrade

sudo gem Update–system

3.4 View Current version

Gem–version

3.5 to clear expired gems

Gem cleanup

3.6 Installation Package

Gem install Ruby

3.7 Unload Package

Gem Uninstall Ruby

3.8 Updating a locally installed package

Gem Update

3.9 Listing locally installed packages

Gem List

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/extra/

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.