1, Cocoapods is running in Ruby software, installation may take several minutes, install named:
sudo gem install Cocoapods
2, if you want to generate documents for each third party library, run
The Brew install Appledoc This step is optional.
After the installation is complete, prompt:
If your ruby environment is not new, you may want to update it:
Gem Update--system
Now pod is installed, how to use it?
Search
First try the search function, what library you need, you can use pod to search, such as to use Jsonkit this library:
Pod Search is named after the name of the library.
Pod Search Jsonkit
Search out:
Class
OK, in the end Shell CD comes to the project you want to manage, run: Pod install
After running, you will find that your project directory is like this:
More *.xcworkspace pod and other documents. This is the pod-generated project management file that opens the Libdemo.xcworkspace project file, which is seen in Xcode as a directory structure:
To add a library:
Vim Podfile Open the file and add the Jsonkit just to the search.
Platform:ios
Pod ' Jsonkit '
Save exit.
Running: Pod update
This is the Jsonkit library download and associated with the local project, this is Xcode prompts you to update the project
Dot revert.
At this time you look at the Project pod section, more Jsonkit library. Well, the third party library is so magical to add in.
Header file path
Then try to use JONSKit.h, in VIEWCONTROLLER.M quote. Can't find the end file, what to do? The directory of the header file has not been set up in the target of the project:
As shown in the following figure, enter ${srcroot} and select Recursive.
In the reference header file:
Perfect.
Other third party libraries.
Podfile file is added after pod update OK.
Platform:ios, ' 5.0 '
Pod ' Jsonkit '
Pod ' afnetworking '
Pod ' Mbprogresshud '
Pod ' reachability '
Pod ' Nimbus/core '
For example, I quote the above library, Nimbus is too big, I only need Core, also can write this.
Cocoapods also has many advanced features that can be used on demand.