[CocoaPods] CocoaPods: Objective-C library dependencies management (XCode 4.6)

github:https://github.com/CocoaPods/CocoaPods

Official Website: http://www.cocoapods.org/

 

1, install RubyGems

RubyGems official website: http://rubygems.org/

RubyGems Download: http://rubygems.org/pages/download

After a successful download, unzip

Open the terminal, cd open

Excuting an order:

sudo ruby setup.rb

 

2, installation CocoaPods

Terminal, execute the command:

sudo gem install cocoapods

Error:

Building native extensions. This could take a while...
ERROR: Error installing cocoapods:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/xcodeproj-0.5.2 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/xcodeproj-0.5.2/ext/xcodeproj/gem_make.ou

 

solution:

Reference: https://github.com/CocoaPods/cocoapods.org/issues/19

Open XCode, Preferences -> Downloads -> Components, download Command Line Tools

Command Line Tools After a successful download, reinstall, success!

 

Terminal execute the command:

pod setup

And so on for a long time ......

Setting success!

 

3, write Podfile

Under the project root directory, create a text file named: Podfile

Query library, terminal execute the command:

pon search [QUERY]

Searches for pods, ignoring case, whose name matches `QUERY'. If the
`--full' option is specified, this will also search in the summary and
description of the pods.

 

Write Podfile, to install ASIHTTPRequest, for example, as follows:

platform :ios
pod 'ASIHTTPRequest'

 

4, the installation library

After completion of the preparation Podfile file, terminal execute:

pod install

And so on for a long time ......

Project PodSample for example, the successful installation directory, probably look like this:

Note: After it, open the project, open the .xcworkspace file, rather than .xcodeproj files!

 

5, using

In ASIHTTPRequest an example, only necessary #import <ASIHTTPRequest / ASIHTTPRequest.h> 

Too convenient! ! !

 

 

Reproduced in: https: //www.cnblogs.com/dyingbleed/archive/2013/03/21/2972610.html

Guess you like

Origin blog.csdn.net/weixin_34010949/article/details/93301860