Problems encountered during cocoapods installation and installation, cocoapods Process
1. $ ruby-v // check the current ruby version. My version is ruby 2.0.0p648 and earlier than 2.2. Therefore, problems may occur when installing cocoapods below.
2. $ gem sources-l // view the current ruby source, the default is https://rubygems.org/because of firewall problems we need to replace into a domestic Image
3. $ gem sources -- remove https://rubygems.org // remove the previous ruby Source
4. $ gem sources -- add https://gems.ruby-china.org/or gem sources-a https://gems.ruby-china.org/replace add a domestic mirror source or https://ruby.taobao.org/(I heard this image seems to have stopped maintenance, it can still be used)
5. $ sudo gem install cocoapods // install cocoapods
6. When you use the $ sudo gem install-n/usr/local/bin cocoapods // command to install pods, the following error occurs because the ruby version is earlier than 2.2,
After checking the ruby version, as mentioned in the first step, the version is earlier than 2.2, so it is not installed successfully. If your ruby version is later than 2.2, you can skip to step 2.
For example:
7. here you need to upgrade Ruby to view all current ruby versions:
$ Rvm list known
After the command is executed, the command not found must be installed first.
$ Curl-L get. rvm. io | bash-s stable // install rvm
If installed, all ruby versions are listed:
No rvm exists in my computer and I have installed it:
Rvm installation takes a long time. You need to enter the carriage return and password twice in the middle of the installation process, which takes a long time.
8. run $ source ~ after the installation is successful ~ /. Rvm/scripts/rvm does not output anything. Then, run rvm-v to view the current rvm version.
9. Use rvm to install the ruby environment. Of course, you must install a version later than 2.2. I installed 2.4 here. You can use vrm list known to query the current maximum version.
Enter the command: $ rvm install 2.4.0 // install ruby of version 2.4
This will take a long time. Successful
10. You can use $ ruby-v to view the current ruby version.
11. After that, you can install cocoapods. If you run $ sudo gem install cocoapods // to install cococoapods, the system will prompt you to enter the password (you can press enter without any response ). Is the successful installation part:
12: Run pod -- version // to view the current cocoapods. You can use sudo gem-v to view the gem ruby version.
13: cd Desktop // you can drag a project to open the Desktop.
$ Cd/Users/mac/Desktop/test/ceshiSecond // open the project directory
Ls // view the directory under the current directory
$ Vim Podfile // use vim to edit a file
Go to the following page:
Press 'I' on the keyboard.
The following "Podsfile" 0L and 0C will become -- INSERT --
Then you can edit the text and enter the following text
Explain
Platform: for ios, the lowest version supported by the '7. 0' download library is iOS 7.0,
'Ceshisecond' is the name of your project,
Pod 'afnetworking', '~> 3.1.0 'indicates that the AFNetworking version to be downloaded is 3.1.0 or later. You can also remove the following' ~> 3.1.0 '. If not 3.1.0. Download AFNetworking to the latest version.
Press esc and enter: wq to save
14. $ pod install // it takes some time to download the library to xcode.
Close the xcode window, and then click the meeting project to add a. xcworkspace file. Then double-click it to open the project.
If you have any questions, please kindly advise...