Upload your own projects using CocoaPods

1. First create a warehouse on git. Insert image description here
2. Insert image description here
Step 1 is the name of the warehouse, which is used to display in github.
Step 2 is whether to open source, generally choose open source.
Step 3 is to initialize the readme file. It is recommended to check
Step 4 to select a license. Commonly used ones include Apache License2.0, GNU General Public Licensev3.0 and MIT License. Bloggers generally use the Three MIT Licenses, please note that the license is required! It’s a must! It’s a must!
There is also add .gitignore to choose Objective-C. Click Create repository to complete the creation.

3. Enter the home page and copy the git address Insert image description here
4.1. Open the terminal and cd to the path you need to download in the command line
2. git clone the url you just copied
3. cd to the download file to the directory path
4. Drag the file you need to upload Go to the directory path of the downloaded file
5.git add -A
6.git commit -m 'Remarks'
7.git push origin
Insert image description here
The complete file directory is as shown below: Insert image description here
5. After success, the code will be uploaded to your github warehouse, you can open it Check the warehouse. Next, you need to tag the project and synchronize it to the remote warehouse:

git tag 1.0.0
git push origin --tags

6. Now that the ithub-related operations are complete, we need to start preparing for uploading cocoapods. First, create a podspec file and execute it in the project root directory:

pod spec create hzqCocoaPodsTest

My folder name here is hzqCocoaPodsTest, so change it according to your actual situation. After the creation is completed, make changes to the podspec and open the podspec file with sublime text. The content that needs to be modified is as follows: 7. Insert image description hereInsert image description here
Then you need to register a trunk account (if this is not the first time, enter: pod trunk add -owner ARAnalytics email):

pod trunk register 邮箱 昵称 --description="描述"

After success, there will be a prompt to open your mailbox for verification, open your mailbox and click the link to verify (it may be in the trash). After verification, enter:

pod trunk me

Verify to see if activation is successful. Then check locally whether the spec file is qualified:

pod spec lint hzqCocoaPodsTest.podspec

If an error is reported, modify it according to the prompts. If it is a warning, you can execute:

pod trunk push --allow-warnings

This step may take a long time and may cause network errors:
[!] There was an error pushing a new version to trunk: Net::OpenTimeout
Just re-execute the command.
If:
[!] Unable to accept duplicate entry for: test (0.0.1) appears
, it means that the submission to the cocoapods warehouse has been successful, then it is possible that the local warehouse has not been updated. Update local repository:
pod repo update --verbose

Displaying this information means that you have uploaded successfully. You can execute:

pod search TestCocoapods

Make an inquiry.

After the above operation is successful, you can use cocoapods to use the library you uploaded.

Guess you like

Origin blog.csdn.net/qq_31709953/article/details/101676925