Add cocoapods support to your GitHub code

Source: Internet
Author: User
Tags sublime text

First, prefaceThese two days were cocoapods tortured by the heart and haggard. See the Cocoapods official website add support, but the introduction of (Ying) than (Yu) simple (Tai), and some of the steps are not written, resulting in the official document is not successful, and later looked at Pinterest, Cocoachina, etc., or has been close to the crash. There is not a complete introduction. More than a few document comparison test, and finally successfully made their own github on the library successfully support Cocoapods installation.Second, startHere I'll start with an introduction, including a project on GitHub that has been uploaded to the final support Cocoapods. The steps are as follows:
    • Code upload GitHub
    • Create a Podspec file and verify that the
    • Create release version on GitHub
    • Register Cocoapods Account
    • Upload code to Cocoapods
    • Check if the upload was successful
1 Code upload GitHubFirst we open the github.com and then create our own project project:

Note The MIT License here, which will be used when adding cocoapods support later (described later). then click Create. Then use the Soucetree code down to the local, put their own items inside, folder:

The license here is the one that just said MIT license added. Rsademo is an example project, and Zgrsaencryptor is a library for others to use. (Zgencrptor (for Java). zip is the back-end code) and then submit it to GitHub.2 Creating a Podspec fileWe use the terminal to the project directory:

Then execute the following command:
Pod Spec Create Zgrsaencryptor
The zgrsaencryptor here is the name of the pod-added city (for example, Mbprogresshud). Results after execution:

In this case, there will be one more Zgrsaencryptor.podspec file under the project folder. Here I opened with sublime text and made the following edits:
Pod::spec.new Do|s|S.name="Zgrsaencryptor"s.version="1.0.0"s.summary="A Library for IOS to use for RSA encryptor."S.homepage="Https://github.com/ScottZg/ZGRSAEncryptor"S.license="MIT"S.author= {"Scottzg"="[email protected]"} s.source= {: git = ="Https://github.com/ScottZg/ZGRSAEncryptor.git",: Tag ="#{s.version}"} s.source_files="zgrsaencryptor/*. {H,m}"End
Name: Class library names Here are the fields that are described below: Version: The edition of the Library summary is the introductory language, that is:

Homtepage:github Project Address License: License Author: Author Source: HTTPS link address for project Source_files: The code to be shared, here is all the code below Zgrsaencryptor. Next, execute the following command to verify:
Pod Lib Lint Zgrsaencryptor.podspec
The results are various, if wrong, follow the instructions to change the error. Here, I perform the results such as:

Multiple warnings were found, as long as it is not an error, the warning can be ignored directly (red also hints how to ignore):
Pod Lib Lint zgrsaencryptor.podspec-allow-warnings
The results are as follows: When you see Zgrsaencryptor passed validation, it means that the validation has passed.3 Create release version on GitHubOpen the catalog for the project, and then create the release version of the class library:

Click the arrow to start creating Release version, (click Create a new Release):

Click Publish Release. After creation: So the third step is done.4 Register Cocoapods accountTo execute the command line:
Pod Trunk Register email address ' user name '-description=' description information '
After execution, the results are as follows:

Yellow hint has sent a verification code to the mailbox, you can open your mailbox verification. Open the link in the message as follows:

This will successfully register the Cocoapods account. can be used
Pod Trunk Me

Check whether the creation was successful. The results of the success are as follows:

5 Uploading code to Cocoapods

Check the validity of the file format first:
Pod Spec Lint
The results are as follows:

There are no errors, but there are warnings. You can use-allow-warnings to ignore:

The appearance of passed validation proves that it has been verified. Then execute:
Pod Trunk Push Zgrsaencryptor.podspec-allow-warnings
The execution results are as follows: (speed should be slow)

Description has been uploaded successfully.6 Check if the upload was successfulUse
Pod Search Zgrsaencryptor
The results are as follows: OK, it has been successful. This makes it possible for others to use the search.Iii. SummaryBaidu, Google a number of documents, and then to summarize, and finally realized the construction of their own cocoapods library. In the back I will continue to studyHow to build a private library in the local building, how to build the company in the multi-person development. Iv. Reference documents:1, HTTP://WWW.COCOACHINA.COM/IOS/20160415/15939.HTML2, HTTP://WWW.COCOACHINA.COM/IOS/20160907/17501.HTML3, HTTPS ://cocoapods.org/

Add cocoapods support to your GitHub code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.