IOS Development Certificate application and implementation app message push (latest) __ios

Source: Internet
Author: User

First paste the original post address: http://blog.csdn.net/shenjie12345678/article/details/41120637


First part

The first step, of course, is to introduce Apple's push mechanism (PS: In fact, every tutorial has), first of all, look at an Apple's official APNs to explain the outline.

Provider is a server that sends a push message to your mobile phone, and APNs (Apple push Notification Service) is a MAC message Push server. Your local server, when you need to push a message to the application, first send the message to the Apple push server, and then send the message to the phone where the app is installed by the Apple push server.

Let's look at one more illustration:


According to the logic of the above diagram I will explain to you:

1. Your iOS application needs to register the APNS message push function.

2. When the Apple APNs push service receives the registration message from your application, it will return a string of device token to you (very important)

3. Transmit the device token received to your local push server.

4. When you need to push the message for the application, your local push server will send the message and device token to the Apple APNs suit.

5.APNS then push the message to the target iphone


Part II

1. Issuing certificates from a certification authority

Turn on your Mac keychain access: Then click on Keychain Access

Then it pops up a window user email message

To fill in the name of your Apple Developer account (should be a mail name), click on the option to save to disk, click Continue, show the following



Click Save, file name: Certificatesigningrequest.certsigningrequest then put him in a folder. Let's name the push.


Part III


Visit Apple Developer URL: https://developer.apple.com/

Select the Membercenter option, go to the landing page, use your Apple Developer account login, and the page will automatically jump to the next image.

Click on the Red selected section

Content to do the next steps.


Select the Certificates option to set up the certificate, as shown in the figure to explain first

The development option, as the name suggests, is used as a certificate for development, and the production option

is used to publish the product used, the name is very strange is not that the previous developer Web page is not this option, may be Apple changed him, with this name more can make people

Understand (literally the product). Two options to generate the certificate are the same, now we use the Developer's option to make the certificate, the following steps:

Select development option


Click the plus option above,


Select the APNS option (development is certainly in the sandbox environment, simulate the real situation), and then continue


This appid we'll talk about how to build in the next section, now I'm using an application ID that has been generated, and continue continue


This is the choice of the key chain access to download the Certificatesigningrequest.certsigningrequest file, select and generate


Click Download to get aps_development. cer and save it to the push file.


Part Fourth

Create a new AppID, select the Appids on the page, and then click the "Plus" in the upper-right corner


The app's name is just what Apple wants it to be.


Then Bundleid is more important, in the submission of audits and testing (Apple TestFlight) and pay links need to be used, and just follow the apple requirements to write.


The next step is to choose which services your app needs to use, such as ads, gaming centers, push, pay, and so on.


Finally select the "Submit" option and select the "Done" option in the next interface so that we can set the AppID steps to complete.


Part V: Generating Provisioning Profiles

This configuration profile is divided into two types, one for development use and one for publishing to the App Store.


Create the release version of the Provisioningprofile and the development version of the same process, click Development and then click on the upper right corner of the plus

Will enter the interface for which configuration profile to choose


We are now testing, so choose the "IOS app Development" option, there are two options in the following distribution release options, "App Store" and "Ad hoc", you can follow the description

Select the options you want to publish. Click Continue to enter the next step.


Select the AppID you created in the previous step and click Continue for next step


Select your developer account and continue for the next step


Select your device in this step (you can only use this signature on the device to debug your device on this step). How to add your device number is also very

Simply, select the "Devices" on the left and click on the plus sign in the upper-right corner to add your device's UUID (which can be viewed in Xcode) and name (which you can read on the page)

Then register, follow the process to the last step is completed.

Okay, how are we going to go back to the provisioning profile configuration link, when you choose your device and click "Continue" to the next page,


Enter a filename (preferably up to understand what is, of course, you can also casually), click "Generate" into the next page, in this page will have a download button to let you download this file,

We downloaded it and put it in the push folder.


Part Sixth

Well, the preparatory work has been done, now let's start pushing. (ROAR)

First double-click our generated "aps_development. cer" file, go to keychain access, and find our dedicated secret key (according to the common name that was filled out in the second section from the Certification authority's certificate operation)


I fill in the second part is "Silicon", because of a Mac installed before the No, no screenshots, so casually found a map for everyone to see, with the wisdom of everyone should not be difficult to understand it.

Then right-click the export, and the diagram shown below will pop up.



Store him in the push folder, named "Push.p12," where the export will let you enter the password and verify that you can customize a password, such as abc123.


There should now be several files in the Push folder "Aps_development. cer", "PUSH.P12", "Certificatesigningrequest.certsigningrequest", and the configuration profile that was just down.


Next we open the terminal to generate the. pem file

1. Generate the. pcm file with the aps_development. cer file, CD to the Push folder


2. push.p12 file as a. pem file


The password entered above is the password that you have set up to export the certificate, that is, abc123. It will then let you enter the password for the. pem file, or use the abc123 to prevent confusion.

So we got two more files in the Push folder, Pushchatcert.pem and Pushchatkey.pem.


3. Merging Pushchatcert.pem and Pushchatkey.pem into a PEM file,


There is another CK.PEM file in the Push folder, and we have all the files we need to use.


The next test, is not very excited ~

In order to test the status of the certificate work, we can use "Telnet gateway.sandbox.push.apple.com 2195" to detect if the display


It means success.


We then use our generated certificate and private key to set up a secure link to link to the Apple server

Related Article

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.