Add Cocoapods support and githubcoapods to the uploaded Github code.
StartHere I will introduce it from the very beginning, including creating a project on Github and uploading the project to the final support for Cocoapods. The procedure is as follows:
- Code upload Github
- Create a podspec file and verify whether the file passes
- Create a release version on Github
- Register a CocoaPods account
- Upload code to CocoaPods
- Check whether the upload is successful
1. Upload the code to Github. First open github.com and then create your own project:
Pay attention to the MIT License, which will be used later when Cocoapods support is added (will be introduced later ). Click create. Then, use SouceTree to run the code down to the local device and put your project in the folder:
The LICENSE here is the file added by the MIT License just mentioned. KG_GCDTimerDemo is a sample project. KG_GCDTimer is a library provided for use by others and then submitted to Github. 2. Create a podspec file. Use the terminal to go to the project directory:
Here, KG_GCDTimer is the name of the market added to the pod (for example, MBProgressHUD ). Result After execution:
In this case, a KGGCDTimer. podspec file is added to the project folder. Here I open it with Sublime Text and edit it as follows:
Next, run the following command for verification:
QiyankundeMacBook-Pro: KG qiyankun $ pod lib lint KG_GCDTimer.podspec
When you see the KGGCDTimer passed validation, it indicates that the verification has passed.
3. Create a release version on Github
Click Publish release. After creation:
4. register the CocoaPods account and execute the command line:
Pod trunk register email address 'user name'-description = 'descriptive information'
Open the link in the email to register the Cocoapods account.
Available
pod trunk me
Check whether the creation is successful.
5. upload code to CocoaPods
First, check the validity of the file format:
pod spec lint
Warning can be ignored using-allow-warnings.
The passed validation is successful. Then execute:
pod trunk push xxx.podspec —allow-warnings
Wait for the previous success
6. Check whether the upload is successful.
pod search XXX
Reference: // execute pod spec lint error set 0, http://www.jianshu.com/p/283584683b0b//1, http://www.cnblogs.com/zhanggui/p/6003481.html2, http://www.cocoachina.com/ios/20160415/15939.html3, http://www.cocoachina.com/ios/20160907/17501.html4, https://cocoapods.org/