Installation process for IOS latest version CocoaPods

Source: Internet
Author: User
Tags network function install cocoapods

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, it is very troublesome to manually download the required class library. 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. Installation process for IOS latest version CocoaPods
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-l4. Install 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
6. Create a new project and use the CD instruction in the terminal to the folder
$pod Search Third Party
7. New file Vim "Podfile",
$vim Podfile
Write the following and save the tip: (the terminal vim file can be edited by I, ESC exits edit: Wq can be saved exit)
Platform:ios, ' 6.0 '
Pod ' afnetworking ', ' ~> 2.3.1 ' <-------third party
8. Import third-party libraries
$pod Install
9. Exit the terminal
Here are some of the errors I encountered when I installed with the previous installation process
Terminal cocoapods download Bug debug:
Error 1:
Error fetching http://ruby.taobao.org/:
Bad response not Found 404 (http://ruby.taobao.org/specs.4.8.gz)
Solution: Change the installation process $gem sources-a http://ruby.taobao.org/---to----> $gem sources-a https://ruby.taobao.org/
Error 2:
Error:while Executing gem ... (errno::eperm)
Operation not permitted-/usr/bin/pod
Solution: The Apple system upgrade OS X EL Capitan will appear after the plug-in error, will install the process 4. Install Cocoapods (1) sudo gem install cocoapods--> to sudo gem install-n/usr/l Ocal/bin Cocoapods
Error 3:
[!] Unable to satisfy the following requirements:-' Avoscloud (~> 3.1.6.3) ' required by ' podfile '
Specs satisfying the ' Avoscloud (~> 3.1.6.3) ' dependency were found, but they required a higher minimum deployment Targ ET. Solution: Installation process: Podfile file in Platform:ios, ' 6.0 ' behind the 6.0 is the platform version number, be sure to add success, if you cannot import header file header file path that try to use JONSKit.h, in Viewcontroller. M-Quote under. Can not find the head file, how to do? The header file has not been set


Okay, in the terminal shell CD comes to the project you want to manage, run: Pod install

When you're done, you'll find something like this in your project directory:

More *.xcworkspace pods and other files. This is the project management file that pod generates, open the Libdemo.xcworkspace project file, and see in Xcode the directory structure:

Add a library:

Vim Podfile Open the file and add the jsonkit you just searched for.

Platform:ios
Pod ' Jsonkit '

Save exit.

Run: Pod update

This is to download the Jsonkit library and associate it with the local project, which is Xcode prompting you to update the project

Set in the target of the project: as shown, enter ${srcroot} and select Recursive.

In the reference header file:

If you change the integration of frame one, afnetworking

There is no one of the third-party network libraries currently using the largest number. From the beginning of the nsurlconnection to the present nsurlsession, it has been maintained with the Apple unison, and it also derived a large number of related third-party network function library, not only because of his reliable, easy to use, has maintained a maintenance update, It is also why it is so favored by the vast number of programmers.

The following first to our project integration Afnetworking (here is the cocoapods to manage and integrate the third-party class library, about its installation, we have a pre-school installation tutorial Cocoapods Introduction and installation and use, I will not much nonsense):

Then press the "I" key to enter the edit state and paste the pod statement you just copied:

After the paste is finished, press "ESC" key, exit edit, and then enter ": Wq", Save and exit Vim, you will find the project root directory more than a podfile file.

If you see the above hint, it means the installation is complete. Now we can use it very well (remember that after integration is complete, to reopen the project and not to enter from the original launcher, select the program with the suffix. Xcworkspace open).

Installation process for IOS latest version CocoaPods

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.