IOS CocoaPods installation process, ioscocoapods

Source: Internet
Author: User
Tags network function install cocoapods

IOS CocoaPods installation process, ioscocoapods
CocoaPods installation process for the latest iOS version
1. Remove existing Ruby default sources
$ Gem sources -- remove the https://rubygems.org/
2. Use the New Source
$ Gem sources-a https://ruby.taobao.org/
3. Verify that the new source is successfully replaced.
$ Gem sources-l
4. Install CocoaPods
(1) $ sudo gem install cocoapods remarks: After OS X EL Capitan is upgraded to $ sudo gem install-n/usr/local/bin cocoapods
(2) $ pod setup
5. Update gem
$ Sudo gem update -- system
6. Create a project and run the cd command on the terminal to the folder.
$ Pod search third-party
7. Create a file vim "Podfile ",
$ Vim Podfile
Write the following content and save the tips: (terminal vim file can be edited by I, esc exit editing, and wq can be saved and exited)
Platform: ios, '6. 0'
Pod 'afnetworking', '~> 2.3.1 '<------- third party
8. Import a third-party library
$ Pod install
9. Exit the terminal
The following are some of the errors I encountered during the installation process.
Cocoapods download bug debugging:
Error 1:
Error fetching http://ruby.taobao.org /:
Bad response Not Found 404 (http://ruby.taobao.org/specs.4.8.gz)
Solution: Change $ gem sources-a http://ruby.taobao.org/--- in the installation process to ----> $ gem sources-a https://ruby.taobao.org/
Error 2:
ERROR: While executing gem... (Errno: EPERM)
Operation not permitted-/usr/bin/pod
Solution: a plug-in error occurs after OS X EL Capitan is upgraded for Apple. Installation Process 4. install CocoaPods (1) sudo gem install cocoapods --> change to sudo gem install-n/usr/local/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 target. solution: Installation Process: platform: ios, '6. 0' the 6.0 behind the header file is the platform version number. If you cannot import the header file path, try to use JONSKit. h, in ViewController. m. What should I do if I cannot find the header file? You have not set a header file.


Okay. In the terminal shell, cd comes to the project you want to manage and run: pod install

After running, you will find that your project directory is like this:

*. Xcworkspace pod and other files are added. This is the project management file generated by the pod. Open the LibDemo. xcworkspace project file and see the following directory structure in Xcode:

Add a Library:

Vim Podfile open the file and add the JSONkit you just searched to it.

Platform: ios
Pod 'jsonkit'

Save and exit.

Run: pod update

In this way, the JSONKit library is downloaded and associated with the local project. This is why Xcode prompts you to update the project.

Directory, set it in the Target of the project: As shown in, enter $ {SRCROOT} and select recursive.

In the reference header file:

If you replace framework 1 and AFNetworking integration

Currently, no third-party network library is used most frequently. From the beginning of NSURLConnection to the current NSURLSession, it has been consistent with Apple's pace, and it also produces a large number of related third-party network function libraries, not only because of its reliability, it is easy to use and maintains updates, which is why it is favored by the majority of programmers.

Next, we will first integrate AFNetworking for our project (Here we use cocoaPods to manage and integrate third-party class libraries. For its installation, we have a tutorial on CocoaPods installation and use, I will not talk nonsense ):

Press the "I" key to enter the editing status and paste the copied pod statement:

After the file is pasted, press the "esc" key to exit the editing, enter ": wq", and save and exit Vim. Then, a podfile file is added to the project root directory.

 

The above prompt indicates that the installation is complete. Next we can use it very well (remember to re-open the project after integration, and do not enter from the original Startup Program, select the program with the suffix. xcworkspace to open ).

 

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.