Install the SDK by running the ruby gem command on Mac.
To view the ruby version, open the terminal and enter ruby-v.
First download CocoaPods from GitHub
Terminal input command: sudo gem install cocoapods
Enter the computer password as prompted
An error is prompted during initial installation:
ERROR: Error installing cocoapods:
Cocoapods requires cocoapods-core (= 0.31.1, runtime)
Then I upgraded the gem using sudo gem update -- system.
Run the following command again: sudo gem install cocoapods.
Prompt successful
Run the command: pod setup
Prompt Installation Complete
Use of CocoaPods
Run the command: pod search "name of API" to view the version information of the third-party library.
Terminal cd to the folder where the project is located
Run the command: pod init
Create a Podfile
Double-click Podfile and paste the library to be added.
Format: pod "name of API", "~> Version Number"
Save files
Terminal command: pod install
The project generates a file named project name. xcworkspace. You can use this file to open the project later.
After the pod, the system cannot find the header file. Although you can write it on your own, it is awkward. I checked the steps on the Internet to set the directory of the header file, in the Target of the project-& amp; gt; build Settings-& amp; gt; user header search paths enter $ {SRCROOT} and select recursive