1. Installation
First of all, you need to know that Taobao's ruby software source cannot be used. Now you can use this source that Ruby China community focuses on maintaining (/)。
First, open the terminal and execute the following command to delete the original ruby source:
gem sources –remove /
Then add the source mentioned earlier
gem sources -a /
Check whether the new source is replaced successfully
gem sources -l
Then install the pod and execute the sudo gem install cocoapods command.
2. Use
First, in the terminal cd to the target project directory, that is, in the same directory as the file with the xcodeproj suffix.
$ cd [project path]
Then create and edit the Podfile
$ vim Podfile
After the command is executed, first enter i to enter editing mode. Enter the following data, then press the ESC key, enter: wq, save and exit
# When using it, you need to create a new file named Podfile. In the following format, you can list the dependent library names in the file in sequence. # Specify platform and system version platform :ios, '8.0' # indicates that a framework that can use swiftuse_frameworks! # This is a must after cocoapods upgrade 1.0 # MyApp is the project nametarget 'MyApp' do # Specify the library and the library version pod 'JSONKit', '~> 1.4' pod 'Reachability', '~> 3.0.0' pod 'ASIHTTPRequest' pod 'RegexKitLite' end
Then execute the Podfile file
$ pod install
At this time, when we go to the project directory, we will find that there are more files and folders. We click on the file with the xcworkspace suffix to open the project using pod.
I also need to mention that when I edited the Podfile, I found that even if I was not sure about the framework version, I would generally download the latest version. You don’t need to enter the version number in the future.
The latest installation and use method of iOS pod is all the content I share with you. I hope you can give you a reference and I hope you can support me more.