iOS cocoapods manual block to auto block to import third-party frame forwarding

Source: Internet
Author: User
Tags install cocoapods

    • Cocoapods use

When you develop an iOS app, you'll often use many third-party open source libraries, such as jsonkit,afnetworking and more. Maybe a class library to use other class libraries, so to use it, you have to have to download another class library, and other class libraries to use other class libraries, "The descendants of Endless also", this may be a more special case. In short, the meaning of small, manual one by one to download the required class library is very troublesome. Another common scenario is that the class libraries you use in your project are updated, and you have to re-download the new version and rejoin the project, which is a hassle. If there are any tools to solve these annoying problems, it will be "good." So, you need to CocoaPods.

Cocoapods should be the most popular class library management tool used by iOS, the two annoying problems, through cocoapods, only need a single line of command to completely solve, of course, if you have to set it up correctly. Importantly, most of the well-known open source class libraries support cocoapods. So, as an iOS programmer, mastering the use of cocoapods is essential to our basic skills.

    • Before installing Cocoapods, you should first install the Ruby environment locally. (Use the terminal input code, complete the next step)

1. Remove the existing Ruby default source
Gem Sources--remove https://rubygems.org/
2. Use the new source
Gem Sources-a https://ruby.taobao.org/
3. Verify that the Xinyuan is replaced successfully
Gem Sources-l
4. Installing Cocoapods
(1) $sudo gem install cocoapods Note: After upgrading OS X EL Capitan, the Apple system changes to $sudo gem install-n/usr/local/bin cocoapods
(2) $pod Setup
5. Update the GEM
sudo gem update--system

    • Here's a simple step: never use a terminal to create a file for a frame import podfile
    • Create a new empty file using Xcode (the file needs to be in the first-level directory of the project): Xcode must be Xcode (to ensure the path is quasi-correct)

    • Enter the code for the framework you want to import in this file: Example import afnetworking framework

    • Import Fmdb

    • The project to import the frame (the project to enter the required import frame) after the terminal has entered the CD space and dragged into (or dragged directly into the project to the terminal)

Start importing a third-party framework

    • Pod install--verbose--no-repo-update or pod install (use the first one faster)
    • The first time to use the download resources are slow, patient waiting for the second use soon

    • Successful cases of Import

    • Before you can use the header file under the Import framework after modifying the settings: Enter ${srcroot} and select Recursive

iOS cocoapods manual block to auto block to import third-party frame forwarding

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.