Xcode integrated POD tutorial

Preparation:

First, we need to install POD on our computer, enter the command line, and enter the following command
sudo gem install cocoapods

Since it is an installation operation, we need sudo to obtain administrator privileges. After pressing Enter, we will see the word password, enter the password of our computer.

Then , the computer will automatically install POD and

see "20 gems installed" to indicate the installation. finished. The following is the operation of how to integrate POD into our project.

Step1:

We first create a project and name it "POD test"

Step2: Enter

the current project folder in the command line.

:

cd + space + file name = enter the folder

cd + space + .. = return to the previous directory

pwd view the current directory

Step3:

Enter the command to view the help to view the help
pod --help


Step4:

Initialize POD
pod init

Step5:

View all file directories under the current file
ls -al


We will find that there is a file called Podfile, we use the vi compiler to modify it, add the frameworks and plugins we need,

enter the following statement to edit the Podfile file
came Podfile


Press "i" to enter the editing mode, move the cursor to the desired position, and enter the following command
under 'AFNetworking', '~> 2.5'


Press "esc"+"shift"+":" to exit the editing mode,

enter "wq", press Enter, and exit the vi compiler

Step6:

Enter the following statement to prepare for installation
pod install


As a result, this situation occurs. According to the prompt, it is because the Xcode of my current project is not closed, and Xcode cannot be opened during installation, so let's close Xcode first and do

it again.
pod install


Now the installation is successful.

Let's check the folder directory of our project and we

will find an additional workspace project. Yes, it is this guy. Our original project is still there. If we want to use a project that integrates POD in the future, we must use the workspace project.

Then we can use the library we installed.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326171059&siteId=291194637