Cocoapods installation and use, cocoapods Installation and Use
During programming, third-party class libraries are often used to improve efficiency and save time, But manual import is troublesome, therefore, we need to use a variety of database management tools which are the most common-cocoapods.
Before introducing cocoapods, we need to explain that there is no ruby environment or cocoapods environment in China. Therefore, our smart Chinese people have invented a ruby image and cocoapods image that can be used in China, of course, you may also encounter a problem during the installation, that is, the cocoapods gem (Version). Sometimes, the gem needs to be upgraded and some Xcode plug-ins (not required ), readers should pay attention to this detail. it takes a long time for you to download a class library. If someone else needs to download a class library for a short time, you need to check whether a foreign environment is used or the plug-in is missing.
Now, the dessert is complete. below is our main dish.
First, let's open the terminal:
1. Remove the ruby Source Address
After the $ symbol, enter:
Gem sources -- remove https://rubygems.org/
2. Add the ruby Source Address
Gem sources-a http://ruby.taobao.org/
3. view the ruby Source Address
Gem sources-l
4. Install cocoapods
Sudo gem install cocoapods
// Note: If sudo is used to obtain administrator permissions, you must enter a password. If you enter the password, no prompt is displayed.
5. If you are prompted that the gem version is too low, you need to upgrade the gem
Sudo gem update-system
6. Test whether cocoapods is successfully installed.
Pod search afnetworking
// Note: afnetworking is a third-party name and can be changed to another one. Fuzzy search is supported.
// If the operation fails, the following message is displayed: Setting up CocoaPods master repo.
// There are two steps to install cocoapods: A. Install cocoapods in the cocoapods environment B. Create the master branch of cocoapods (equivalent to A copy of checkout from the cocoapods server to your computer)
7. Remove the cocoapods Primary Branch
Pod repo remove master
8. Modify the cocoapods address
Pod repo add master https://gitcafe.com/akuandev/Specs.git
// Where https://gitcafe.com/akuandev/Specs.git
Can also be turned into a http://git.oschina.net/akuandev/Specs.git
9. Update cocoapods master Branch
Pod repo update
Use cocoapods
1. Create a Project (Project name: text3) on the desktop and drag it to the terminal cd.
Note: This terminal is re-created, not the same
2. The main directory of the cd project in the command line
For example:
Cd/Users/lanouhn/Desktop/text3
3. Create a file named Podfile
Example: vim Podfile
4. Write the third-party class library you want to add to Podfile
For example: pod 'jsonkit', '~> 1.5pre' (name of the class library to be used)
5. Save the Podfile and exit
Example: wq
6. Install a third-party class library
For example, pod install
7. From now on use 'text3. xcworkspace '.
Open *. xcworkspace,
Note that the last sentence means that text3.xcworkspace will be used to open the project later, instead of the previous. xcodeproj file.
// Note: You must disable the previous project.
How to install CocoaPods?
Code4app.com/...-usage: Check it out.
After installing office 2013, the following error occurs: "This item is not suitable for use in a specified state" can be installed on another computer. Why is it not available on my computer?
There are residual files of previous versions in the system. After detaching a previous version (if any), use security guard or similar programs to clear the system and then install the new version. Chinese folders cannot appear in the installation path.