Follow the steps below to publish your own cocoapods open source library. It is made with conscience and will teach you everything you need!! Below I will explain the whole process through a project called IFMMenu. 1. Write the code and upload it to github When creating a project repository on GitHub, remember to create a LICENSE (license/authorization) file. This file is required. Create a project repository on GitHub 2. Tag your project Because cocoapods relies on tag versions, you must tag your project. To update it again in the future, you only need to tag your project, then modify the version in the .podspec file and submit it to the cocoapods official. Please see the submission command below
3. Register CocoaPods Trunk requires CocoaPods version 0.33 or above. Use the pod --version command to check the version. If the version is lower, you need to upgrade.
If you have already registered, you do not need to register. How can you check whether you have registered?
pod trunk me information If you are not registered, execute the following command, and enter your email and username. I use the username on Github.
After registration is completed, an email will be sent to your mailbox. There is a link in the email and you need to click to confirm. After registration is complete, use pod trunk me to verify whether the registration is successful. 4. Create .podspec cd to your project directory and execute the command
5. Edit .podspec After creation, open .podspec, delete the comments, the ones with # in front are comments, or you can replace them with the following code, and then edit your own library information.
Other non-essential fields
It is recommended to write it like this. If you write something else, a warning will be reported, resulting in subsequent submission failures. Source_files writing method and meaning
* means match all files *.{h,m} means matching all files ending with .h and .m ** means match all subdirectories s.source common writing method
6. Verify .podspec Check here to see if you have the following files in your project:
Project files Use the following command to test your local .podspec file for syntax errors.
7. Release
It takes a long time, please wait patiently, about 5-10 minutes, and the following prompt will appear after the release is successful Post a successful screenshot 8. Test your own cocoapods At this time, if you use pod search to search, you will be prompted that the search is not found. You can execute the following command to update the local search_index.json file
Then
This command will recreate the search_index.json file. Please wait patiently for 5-10 minutes. Search Results Full command
Error handling
Meaning: cannot accept submissions of the same version Solution: 1. Execute the following command
2. Modify the content in the XXXX.podspec file
3. Execute the commands pod spec lint, pod trunk push library name. podspec to verify and submit to CocoPods *** IFMMenu is a multifunctional, customizable drop-down menu that mimics the menu added to the WeChat homepage. Welcome to download and give comments, star, and thank you for reading. |
<<: Android must know-Use Intent to open third-party applications and verify availability
>>: Summary of daily development skills of Gradle
In the experiment, The fuselage and wing structur...
When it comes to user growth , there are models s...
Mixed Knowledge Specially designed to cure confus...
This article is mainly divided into 5 parts: Firs...
Fan Deng’s annual revenue from reading books has ...
(1). Strictly speaking, there is no impact. When ...
The new products launched one after another at the...
I have been in the Internet industry for two year...
Taiji jailbreak team finally released the iOS 8.4...
With the gradual entry of foreign banks into the ...
Double Eleven every year is not only a shopping c...
The day before yesterday afternoon, the cross-bor...
" Laso " receives cosmic rays from W51 ...
Science and Technology Daily reporter Fu Lili Col...
This year, Guangzhou has experienced the longest ...