Use Cocoapods to manage third-party libraries in iOS projects

Source: Internet
Author: User

Cocoapods is an excellent iOS package management tool for managing third-party components, perfect for third-party library updates, inter-dependency relationships, and more. Refer to the Cocoapods home page.

Installation

It is more convenient to change the source in the country.

//会被墙掉。 --remove https://rubygems.org/ -a http://ruby.taobao.org/ -l

After the installation is complete, the output information:

Fromon

Then, open the project in the future and use Xcworkspace directly, not the previous xcodeproj file.

Podfile

Under the current project, there should be a podfile:

‘7.0‘// 有时候这句很重要.‘JSONKit‘‘AFNetworking‘Alamofire‘// 这需要iOS 8.0以上,因为是swift的.// 对swift的支持.

This file contains the third-party class libraries and their dependencies that are managed using Cocoapods in the current project.

Command
    1. The automated installation configuration of these class libraries is performed by performing pod install.
      Pod install will generate workspace, contains swiftweatherpods and pods two directories, and Pods directory contains afnetworking files, the framework is compiled into. a file, You can then refer to the. a file.
    2. For newly added class libraries, you can update the changes using Pod upate. Sometimes slow execution is due to upgrading Cocoapods's spec repository.
    3. Use the pod search name to view a third-party class library,
    4. The Import class library is still the same:
#import Alamofire

For ease of use, you can add the Cocoapods command alias to the system:

alias podinstall=‘pod--no-repo-update ’ alias podupdate=‘pod--no-repo-update ’ 

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Use Cocoapods to manage third-party libraries in iOS projects

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.