Install Cocoapods 1. Remove Ruby's source address gem sources--remove HTTPS://RUBYGEMS.ORG/2. Add Ruby's Source address gem sources-a https://ruby.taobao.org/ Xcode7 recommends using the HTTPS protocol 3. View Ruby's Source address gem sources-l 4. Installing Cocoapodssudo gem install cocoapods//Note: sudo for administrator privileges, so you need to enter a password, When you enter a password, the cursor does not prompt//CD to access the file//ls view the file in the current folder//pwd get the current file path//cocoapods requires a minimum version of Ruby 1.9.3, if required upgrade need to review the following Ruby upgrade 5. If you are prompted that the gem version is too low, Need to upgrade Gemsudo gem Update--system 6. Test the success of the Cocoapods installation pod search afnetworking//Note: afnetworking is a third-party name, can be replaced by other, and support fuzzy search/ /If not installed successfully, prompt setting up CocoaPods Master Repo//cocoapods installation with two steps: a.cocoapods environment installation B.cocoapods Main Branch Creation (equivalent to checkout from the Cocoapods server to your computer) after the installation we also want to test whether we can use 1. or in the terminal step by step 2 Save this step in saving the Podfile file, and exit (press ESC to save the exit) For example: Wq (to press ESC again, press W and then press Q to proceed to the next step) use Cocoapods 1. Create a Project 2. On the command line CD Project home Directory folder for example: Cd/users/fuxiaohui/de Sktop/lessoncocoapods 3. Create a file named Podfile for example: Vim Podfile 4. Write the third-party class library you want to add in Podfile, using pod search * To search for the third-party class library You're looking for, such as:
Platform:ios, ' 6.1 '
Pod ' afnetworking '
Pod ' Sdwebimage '
Pod ' Mjrefresh '
5. Save the Podfile file and exit (press ESC to save exit) For example: Wq 6. Installing a third-party class library For example: Pod install
7: Use in engineering
directly in the project. M tap #import <AFNetworking.h> can be found ~
Cocoapods third-party class library dependency management