IOS development diary 22-CocoaPods, ios22-cocoapods

Source: Internet
Author: User
Tags install cocoapods

IOS development diary 22-CocoaPods, ios22-cocoapods

Today, the blogger has a CocoaPods demand and encountered some difficulties. I would like to share with you the hope that we can make common progress.

CocoaPods is a management tool for a third-party library. We do not recommend CocoaPods for team development. However, CocoaPods is recommended for independent development.

To install CocoaPods, we need FQ first.

Enter

$ Gem sources -- remove the https://rubygems.org/

Wait until there is a reaction and then knock into $ gem sources-a http://ruby.taobao.org/

Then, test whether the problem is true.
$ gem sources -l
*** CURRENT SOURCES ***http://ruby.taobao.org/

OK, FQ is successful.

Step 1: Install

CocoaPods is a software running on Ruby. It may take several minutes to install CocoaPods. Open your terminal input:

Sudo gem install cocoapods

If a Successfully installed cocoaPods prompt is displayed,

Enter

Pod setup

If the Ruby environment is not new enough, your machine will be as old as my machine. Please upgrade it.

Sudo gem update -- system

Well, you have finished the Ruby upgrade. You can repeat the previous steps.

Step 2: Create a Podfile

Continue to operate on your terminal, first use the cd operation to enter your project directory, such as cd ~ /Desktop/HelloWord

Create a file in this directory

Touch Podfile and press enter to continue entering open-e Podfile. At this time, an empty file will be opened directly here.

Step 3: search the database

Now you need to find the third-party library you want and enter it in the terminal (take searching for Reachability as an example)

Pod search Reachability

The marker option is similar to the search result (for example)

-> KSReachability (1.3)
A better iOS & Mac reachability for a modern age.
-Homepage: https://github.com/kstenerud/KSReachability
-Source: https://github.com/kstenerud/KSReachability.git
-Versions: 1.3, 1.1, 1.0, 0.0.1 [master repo]

-> NPReachability (0.1.0)
Reachability without the suck.
-Homepage: https://github.com/Abizern/NPReachability
-Source: https://github.com/Abizern/NPReachability.git
-Versions: 0.1.0 [master repo]

-> Reachability (3.1.0)
ARC and GCD Compatible Reachability Class for iOS and OS X. Drop in
Replacement for Apple Reachability.
-Homepage: https://github.com/tonymillion/Reachability
-Source: https://github.com/tonymillion/Reachability.git
-Versions: 3.1.0, 3.0.0, 2.0.5 [master repo]

Step 4: add the expected content to the blank Podfile you just opened,

Platform: ios8.0 (this indicates the system platform version) pod 'reachability ', '3. 1.0' (the version number of the Library name Library)
(If there are more than one, you can continue listing ):
Platform: ios8.0
Pod 'jsonkit', '1. 4'
Pod 'reachability ', '3. 0.0'

Step 5: Save the Podfile for writing data and disable it.

Step 6: Enter

Pod install

The terminal will display an example:

[!] From now on use 'name. xcworkspace '.

Finally: Yes, as you can see, you need to double-click the. xcworkspace project to open the project, instead of the previous xcodeproj !!

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.