Third-party class library management tools in iOS development-CocoaPods-

Source: Internet
Author: User
Tags install cocoapods

Third-party class library management tools in iOS development-CocoaPods-

 

What is CocoaPods?

When a third-party open-source class library is required in the iOS project, or when the used class library needs to be updated, It is very troublesome to download it one by one. But with CocoaPods, we can solve this problem with one line of commands.

CocoaPods is a third-party open-source tool for managing iOS projects. Cocoa is developed using Ruby and its source code is open-source https://github.com/CocoaPods/CocoaPods on Github.

CocoaPods can save time for setting and updating third-party open-source libraries and improve work efficiency.

Introduction to CocoaPods: gem is a standard package for managing ruby libraries and programs. You can use gem to find and install and uninstall software and install CocoaPods. First, enter the following command on the terminal,
Sudo gem sources-remove https://rubygems.org/enter the following line after the response
Sudo gem sources-a http://ruby.taobao.org/then enter this line to view the address
Gem sources-l

If a prompt similar to the following appears, it indicates OK.

Run the following command on the terminal to install the CocoaPods toolkit. The installation process is slow due to network problems. Please wait patiently.

Sudo gem install cocoapods

Enter the following command on the terminal to initialize <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4NCnBvZCBzZXR1cA0KPHA + s/bP1s/fingerprint + DQo8cD48aW1nIGFsdD0 = "Write picture description here" src = "http://www.bkjia.com/uploads/allimg/150411/0423001464-1.png" title = "\"/>

Enter the pod search AFN on the terminal to view the Framework Version and download the git address.

If the installation is not successful, upgrade the gem

Use pods in The sudo gem update-system project to create a project using xcode

Switch the terminal to the project and use pod init to create a Podfile file.

Edit the Podfile file, enter sudo vi Podfile, import the AFN framework to the left of the figure below, and save

? * Enter pod install to add the related framework to the project, and disable xcode and simulator before executing the command.

The following prompt appears, indicating that your project has been integrated. The download may be slow due to network reasons.

Open the Pods demo. xcworkspace to run the project. Remember not to open the Pods demo. xcodeproj.

All dependencies have been added. We need to import the header file to use

Note that the format of the imported header file can only be imported using angle brackets.

Summary:

All Pods dependencies are configured according to the Podfiles file.

You can specify the pod 'sdwebimage', '~> 0.2.0 ', but this parameter is not specified. If this parameter is not specified, the latest version is used.

When a framework is updated, switch to the project on the terminal and run the pod update command.

To append a third-party framework, search for the Framework, write it to PodFile, and run the pod install command.

The added items are displayed in the following area:

The following are common GEM commands:
????????????????????

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.