I. Summary
When iOS is developed, many third-party libraries are referenced in the project, and CocoaPods (https://github.com/CocoaPods/CocoaPods) can be used to manage these third-party libraries conveniently and uniformly.
Second, installation
As the online tutorials are basically similar, but the details are not very perfect, so the opportunity will be added here:
Note: To use Cocoapods, download and install it, and download and install cocoapods requires a ruby environment
1. Building Ruby Environment
The current installation environment is Mac mini 10.8.5. The Mac OS itself comes with Ruby, but it's still an update, because the first time I installed it failed without updating Ruby.
A view the current Ruby version: Open the terminal input ruby-v (yes, but with this version the next work fails, so update under 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
Terminal Enter the following command (point the Ruby image to Taobao, avoid being the wall, you know)
Gem Sources--remove https://rubygems.org/
Gem Sources-a https://ruby.taobao.org/
Gem sources-l (used to check for successful use of alternate mirror locations)
[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 https://ruby.taobao.org/https://ruby.taobao.org/added to sources ritekimac-mini:~ Luc ky$ Gem SOURCES-L * * * * Current SOURCES * * *
2. Download and install 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: warning: conflicting chdir during another chdir block Done installing documentation for cocoapods after 10 seconds 1 gem installed
This will download and install the Cocoapods
3. Using Cocoapods
A Create a new project, name Podtest
b terminal, CD-to-project directory (note: The head record containing the Podtest folder, Podtest.xcodeproj, Podtesttest)
[OBJC] view plain copy Print