The carding of the relationship between the generated files (CSR, certificates, provisioning files) in the Apple APNs push mechanism, and the various pits

Source: Internet
Author: User
Tags openssl x509 ssl certificate

1. Preface

iOS uses APNs to do push, the process is attached to a picture bar, not much to say



2. The subject

These two days re-engaged for a few days of push, some pits want to point out to everyone, less detours.

What I want to say is that the process needs to use a variety of documents, for you to do a comb, understand the place, please criticize!

Note: Take development as an example, distribution copy can. Similarly, we implement a common Web-based push server implemented with PHP.

2.1 Required Documents

The first is that we eventually need to generate the files in the folder as shown:

The relationships among the various files:


2.2 Curved when generating individual files

1. Generate Certificate Signing Request (CSR):

Under normal circumstances, generate the CSR file as shown in:


When the CSR is generated correctly, a corresponding key appears in the key


Note: The following situation can cause a problem with the certificate!


2. Generate Pushzyq.mobileprovision File

To generate pushzyq.mobileprovision you need to select the corresponding certificate, note that the certificate you need to select here is the ios_development.cer corresponding certificate instead of the SSL certificate

3. Generate PUSHZYQ.P12 File


4. Various commands

Three-Step build Ck.pem File

4.1.

OpenSSL x509-in aps_development.cer-inform der-out Pushzyqcert.pem

4.2.

OpenSSL pkcs12-nocerts-out pushzyqkey.pem-in PUSHZYQ.P12

4.3.

Cat Pushzyqcert.pem Pushzyqkey.pem > Ck.pem

5. About receiving push

The default push prompt is not available until the program exits, so if the current program is running, it can only be judged by a callback method if you want to tune it.

-(void) Application: (UIApplication *) application didreceiveremotenotification: (nsdictionary *) userInfo{    // Handling Push Message    NSLog (@ "userinfo:%@", userinfo);        NSLog (@ "received push message:%@", [[UserInfo objectforkey:@ "APS"] objectforkey:@ "alert"]);}

3. Required Documents

3.1, PHP implementation of the server, because you can not insert a hyperlink, so you can enter the URL in the diagram


3.2. Simple Demo

There are no illustrations in this demo, and you can view them via the console, which is suitable for ios8.0+.


4. Under normal circumstances



The carding of the relationship between the generated files (CSR, certificates, provisioning files) in the Apple APNs push mechanism, and the various pits

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.