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