CocoaPods Installation and use

Source: Internet
Author: User
Tags install cocoapods

1. Turn on terminal
2. Remove the existing Ruby default source

$ gem Sources--remove https://rubygems.org/

3. Use the new source

$ gem sources-a https://ruby.taobao.org/

4. Verify that the Xinyuan is replaced successfully

$ gem sources-l

5. Installing CocoaPods

$ sudo gem install Cocoapods

$ pod Setup

Note: Apple system upgrade OS X EL Capitan after installation instead:

$ sudo gem install-n/usr/local/bin cocoapods

$ pod Setup

6. Update the Gem

$ sudo gem update--system

7. Create a new project and use the CD instruction in the terminal to the folder

$ pod Search third party

8. Create a new Podfile file

$ Touch Podfile

9. Edit the Podfile file and write to the third-party library you want to add

Platform:ios, ' 8.0 '

Pod ' afnetworking ', ' ~> 2.3.1 ' <-------third party

10. Import third-party libraries

$ pod Install

11. Exit the terminal

possible error hints and workarounds: Error 1:

Error fetching http://ruby.taobao.org/:

Bad response not Found 404 (http://ruby.taobao.org/specs.4.8.gz)

Solution: put the installation process in $ gem sources-a http://ruby.taobao.org/

Instead:$ gem sources-a https://ruby.taobao.org/

Error 2:

Error:while Executing gem ... (errno::eperm)

Operation not permitted-/usr/bin/pod

solution: An apple system upgrade OS X EL Capitan will appear after the plug-in error, will install the process 5. Install CocoaPods sudo gem install CocoaPods

Change to sudo gem install-n/usr/local/bin cocoapods

Error 3:

[!] Unable to satisfy the following requirements:

-' afnetworking (~> 2.3.1) ' required by ' podfile '

Specs satisfying the ' afnetworking (~> 2.3.1) ' dependency were found, but they required a higher minimum deployment tar Get.

Solution: Podfile file Platform:ios, ' 8.0 ' behind the 8.0 is the platform version number, be sure to add

Error4:

-----MARKDOWN template――――――――--

# # Report

* What does it do?

* What do you expect to happen?

* What happened instead?

# # # Stack

```

cocoapods:0.29.0

Ruby:ruby 2.0.0p247 (2013-06-27 revision 41674) [Universal.x86_64-darwin13]

rubygems:2.1.11

Host:mac OS X 10.9.2 (13C64)

xcode:5.1 (5B130A)

Ruby Lib dir:/system/library/frameworks/ruby.framework/versions/2.0/usr/lib

Repositories:master-https://github.com/cocoapods/specs.git @ bd6736d07b16c98ab7a1dae04697cae002f25a9b

```

# # Podfile

"Ruby

Platform:ios, ' 8.0 '

Pod ' Mbprogresshud ', ' ~> 0.8 '

```

# # Error

```

Psych::syntaxerror-(/USERS/MAXJ/.COCOAPODS/REPOS/MASTER/COCOAPODS-VERSION.YML): Mapping values is not allowed in This context at line 3 column 4

/system/library/frameworks/ruby.framework/versions/2.0/usr/lib/ruby/2.0.0/psych.rb:205:in ' Parse '

/system/library/frameworks/ruby.framework/versions/2.0/usr/lib/ruby/2.0.0/psych.rb:205:in ' Parse_stream '

/system/library/frameworks/ruby.framework/versions/2.0/usr/lib/ruby/2.0.0/psych.rb:153:in ' Parse '

/system/library/frameworks/ruby.framework/versions/2.0/usr/lib/ruby/2.0.0/psych.rb:129:in ' Load '

/system/library/frameworks/ruby.framework/versions/2.0/usr/lib/ruby/2.0.0/psych.rb:299:in ' block in Load_file '

/system/library/frameworks/ruby.framework/versions/2.0/usr/lib/ruby/2.0.0/psych.rb:299:in ' Open '

/system/library/frameworks/ruby.framework/versions/2.0/usr/lib/ruby/2.0.0/psych.rb:299:in ' Load_file '

/library/ruby/gems/2.0.0/gems/cocoapods-0.29.0/lib/cocoapods/sources_manager.rb:261:in ' Version_information '

/library/ruby/gems/2.0.0/gems/cocoapods-0.29.0/lib/cocoapods/sources_manager.rb:222:in ' repo_compatible? '

/library/ruby/gems/2.0.0/gems/cocoapods-0.29.0/lib/cocoapods/sources_manager.rb:281:in ' master_repo_functional? '

/library/ruby/gems/2.0.0/gems/cocoapods-0.29.0/lib/cocoapods/command.rb:39:in ' Parse '

/library/ruby/gems/2.0.0/gems/claide-0.4.0/lib/claide/command.rb:179:in ' Parse '

/library/ruby/gems/2.0.0/gems/cocoapods-0.29.0/lib/cocoapods/command.rb:38:in ' Parse '

/library/ruby/gems/2.0.0/gems/claide-0.4.0/lib/claide/command.rb:211:in ' Run '

/library/ruby/gems/2.0.0/gems/cocoapods-0.29.0/lib/cocoapods/command.rb:51:in ' Run '

/library/ruby/gems/2.0.0/gems/cocoapods-0.29.0/bin/pod:24:in "

/usr/bin/pod:23:in ' Load '

/usr/bin/pod:23:in ' '

```

-- ----TEMPLATE end――――――――――

[!] Oh No, an error occurred.

Search for existing GitHub issues similar to yours:

https://github.com/CocoaPods/CocoaPods/search?q=%28%2FUsers%2FMAXJ%2F.cocoapods%2Frepos%2Fmaster% 2fcocoapods-version.yml%29%3a+mapping+values+are+not+allowed+in+this+context+at+line+3+column+4&type= Issues

If none exists, create a ticket, with the template displayed above, on:

Https://github.com/CocoaPods/CocoaPods/issues/new

Don ' t forget to anonymize any private data!

Solution:

$ sudo rm-rf ~/.cocoapods/repos/master

$ pod Setup



Wen/Chu Shu (Jane book author)
Original link: http://www.jianshu.com/p/071d30a3af02
Copyright belongs to the author, please contact the author to obtain authorization, and Mark "book author".

CocoaPods Installation and use

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.