Before the whole time cocopods, that I have been thinking I now copy it is also very useful, why must you use Cocopods?
This question has been bothering me for a long time, and I have always felt that it is a waste to learn to use this thing!
Today I tell you that the real usage of cocopods is not only the collection of third-party libraries, such as a lot of third-party libraries, not only dragged in can be used there is a series of parameter configuration, these if manual completion will be troublesome, and others do not understand the query parameter how to set, With Cocopods this thing, you can easily take these tedious things to avoid, directly to him to deal with, you can say that the development of saving a lot of time, also removed a lot of trouble, playing a very simple analogy, you want to use afnetworking, you have to manually join his many dependent library Security.framework, Mobilecoreservices.framework, SYSTEMCONFIGURATION.FRAMEWORK3, once you use the cocopods to download him, Cocopods can automatically help you prepare these libraries you need to install the knowledge of the good!
So here's the problem.
How do I install Cocopods to your Mac?
I tested today, the last use is to find a blog, and then use the terminal a variety of tedious, but also very messy not to remember, important error prone.
Today teach you a simple way, you first need to install a plugin manager for Xcode, this is a baby
You just have to go to GitHub to search Https://github.com/supermarin/Alcatraz download and then click on his xcodeproj suffix file to run once, you can see him in the window inside your Xcode! This is also a very magical way to install plug-ins, only need to run a plug-in project can automatically help me install plug-ins
Then say you have installed, you click the Open interface as follows:
See the Red Word No, you need to download what plug-in, there is this plugin manager, it is very simple to install other plug-ins, you just need to enter the name, and then click on the left red button, he will help you automatically download and install the Xcode plugin you need, after the installation success, The plugin you installed will appear as the second line on the left side of the red button icon color (not gray, turned blue, for you have installed the plugin), OK, now we have installed a good cocoapods.
Here are some questions about how to use Cocopods to be on the safe side, you'd better do the following two parts, after the operation
Open your terminal command line and typed the following two lines of command
sudo rm-fr ~/.cocoapods/repos/master
Pod Setup
And then you do so after the terminal should prompt you, start success and so on, do not know English you can see success and the like words
Because I was having a problem, so I suggest you do so, please refer to the question answer http://blog.csdn.net/jiangyuaiqing/article/details/21417353
After this good, the representative of your Cocopods is officially launched, can be used directly!
Okay, so what's the problem? How do I use it to install your third-party library?
The following is very simple, almost smooth.
You need to click below
Right now you need to create a podfile file under your project folder, but not directly right-click New, but create it by the way you first select the arrow labeled option after he will create the file in your project directory (automatically created without manually locating the CD path or something ...)
Then you need to repeat the click once, because Create/edit podfile is meant to be the first time you click on it to execute create Podfile the second click is Edit podfile
That's right, so after you click the second time, he'll open the Podfile file. Let's write something manually! Write these things and say what third-party libraries we add
Come in when the default is not so display, the reality of some hint of text, and then we ourselves changed to this,
I explain the above two words meaning, the first sentence means your third party libraries on the platform, here write iOS8, you can also write io67 with you
The following pod is the keyword, after everyone understand, one is the name of the third-party library, and a third-party library version information.
Okay, here's the question. The library name basically knows, question how do I know the version information of the library,
Actually very simple, you just need to open the terminal input pod search afnetworking Enter,
The terminal will show the various versions of this library file, you need to use which version, you manually change the above podfile file corresponding to the required version of the library, and then directly shut down the file on the line
All right, now you have the information you want to download in the Podfile file.
Then you select the Install Pods button in the third picture,
At this time you do not have to worry about anything, you will find your Xcode output panel appeared a analayze in English, the marking system has been to help you analyze, and then only need to wait, finally understand good, will pop up a box ask you is not to open workspace, you click Yes, He's going to open the download. Workspace contains your project and Cocoapods project, important has been connected, you can directly #import to your project to use!
A very simple way to use Cocopods on iOS