iOS development ~cocoapods using detailed instructions

Source: Internet
Author: User
Tags documentation install cocoapods

I. Overview

During iOS development, many Third-party libraries are referenced in the project, and Cocoapods (https://github.com/CocoaPods/CocoaPods) can be used to facilitate the unified management of these third-party libraries (from one pit to another). )。


Second, the installation

As the online tutorials are basically similar, but the details are not perfect, so the opportunity will be added here:

Note: To use cocoapods, it is necessary to download and install it, and the download installation cocoapods need ruby environment


1, Ruby Environment to build

The current installation environment is the Mac mini 10.8.5. Mac OS itself has Ruby, but it still updates the insurance because I failed the first time I installed it without updating Ruby.

A view the current Ruby version: Open the terminal input ruby-v (it was installed, but the next work failed with this version, so update ruby)

[OBJC] view plain copy print? Ritekimac-mini:podtest lucky$ ruby-v Ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0] RitekiMac-mini:Pod Test lucky$
b Update Ruby

The terminal enters the following command (Point Ruby Mirror to Taobao, avoid being wall, you know)

Gem Sources--remove https://rubygems.org/
Gem Sources-a http://ruby.taobao.org/
Gem sources-l (used to check for success with alternate mirror location)

[OBJC] view plain copy print? ritekimac-mini:~ lucky$ gem sources--remove https://rubygems.org/https://rubygems.org/removed from sources Ritekima c-mini:~ lucky$ gem sources-a http://ruby.taobao.org/http://ruby.taobao.org/added to sources ritekimac-mini:~ $ Gem sources-l * * * Current SOURCES * * * *

Added: (2016-01-20 update)

Taobao has turned off the HTTP protocol scene service, changing to HTTPS protocol.

Taobao Ruby address: https://ruby.taobao.org/2, download installation cocoapods

Terminal input: sudo gem install cocoapods


[HTML]   View plain  copy  print? ritekimac-mini:~ lucky$ sudo gem install cocoapods      CHANGELOG:       ## 0.32.1      ##### bug fixes       * fixed the podfile  ' Default_subspec '  attribute in nested  subspecs.       [Fabio Pelosin][irrationalfab]    \ [# 2050] (https://github.com/CocoaPods/CocoaPods/issues/2050)          successfully  installed cocoapods-0.32.1   installing ri documentation for  cocoapods-0.32.1  /system/library/frameworks/ruby.framework/versions/1.8/usr/lib/ruby/1.8/rdoc/ rdoc.rb:280: warning: conflicting chdir during another chdir block   /SYSTEM/LIBRARY/FRAMEWORKS/RUBY.FRAMEWORK/VERSIONS/1.8/USR/LIB/RUBY/1.8/RDOC/RDOC.RB:287:&NBsp;warning: conflicting chdir during another chdir block   Done  installing documentation for cocoapods after 10 seconds   1 gem  installed  


So the download is installed Cocoapods


3. Use Cocoapods

A create a new project with the name Podtest



b terminal, CD to the total list of items (note: The head record containing the Podtest folder, Podtest.xcodeproj, Podtesttest)

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.