To install Coacoapods steps:
In the terminal, enter the following command to upgrade the Ruby version:
sudo gem Update-system
This appears to mark the successful installation.
When you are finished, enter the following command:
Gem Sources--add http://rubygems.org/
Enter Y and click Enter. Enter the following command to see if the add succeeded.
Gem Sources-l
Then enter the following command to install Cocoapods:
sudo gem install Cocoapods
If the following error occurs:
This is because Ruby's version is not upgraded to the latest. If the error does not occur, it is skipped. Here's how to fix this error:
Enter the following command first:
Curl-l Get.rvm.io | Bash-s Stable
After completion, enter:
SOURCE ~/.BASHRC
Should not respond, enter again:
SOURCE ~/.bash_profile
There should still be no response, then enter:
Rvm-v
You can view the version of RVM. Keep going down:
Ruby-v
This version of Ruby should not be up to date, enter the following command to list all version numbers: Find the latest version number:
RVM list known
Now the latest version is 2.3.0
Then enter the command:
RVM Install 2.3.0
Install the latest version of Ruby;
After the installation is complete, you can enter the command to install Cocoapods:
sudo gem install cocoapods (10.11 system input sudo gem install-n/usr/local/bin cocoapods)
This will make the installation successful.
Initialize third-party library information (download the third-party library information index locally), and if there is a problem later, you can try this command (and pod repo update), which takes a long time.
Pod Setup
If a green setup complete is present, the success is indicated.
So, under the premise of git configuration ok, copy the file clone directly to local. Then change the folder name to master and drag it to the/users/user name/.cocoapods/repos directory.
You can also one step directly with a command
git clone https://git.coding.net/CocoaPods/Specs.git ~/.cocoapods/repos/master
You can then import a third-party framework into your project,
First switch to the root of the project in the terminal, such as:
Cd/users/gjh/desktop/ios Example/cocoapodstest (cocoapodstest for project name)
Then enter the following command to create the Podfile file:
Touch Podfile
Then enter the following command to pop up the text edit box to edit:
OPEN-E Podfile
The format of the file is now updated, this is a pit, the exact format is as follows, a lot of previous project formats have to be changed: (Cocoapodstest is the project name)
Platform:ios, ' 8.0 ' use_frameworks!target ' cocoapodstest ' dopod ' afnetworking ', ' ~> 3.1.0 ' pod ' Reactivecocoa ', ' ~ > 4.2.1 ' End
Finally, enter the following command to install the third-party framework:
Pod Install
No red is a successful installation, and later open the project with the Cocoapodstest.xcworkspace file.
If you want to know what Cacaopods did during the installation process, you can also add a parameter that prompts us to coacoapods what we did.
Pod Install--verbose--no-repo-update
iOS Development Learning-cocoapods Configuration installation