Apple iOS APNs message push notifications

Source: Internet
Author: User

Reference Links:

http://www.tairan.com/archives/194

http://www.tairan.com/archives/240

https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ Chapters/provisioningdevelopment.html#//apple_ref/doc/uid/tp40008194-ch104-sw2

Operation Process:

1. Configure Appid,enable Push notification option in Developer Center

2, in the app ID push notification option to create a dev and dis certificate, the two certificates used for device, provider, APNs between the registration of communication authentication, and the app itself compiled publishing use of different certificates, You need to select the. certsigningrequest certificate request file when generating the certificate, this is the private key, the certificate is generated to download and install on the development Mac machine, download to a local double-click to install

Below,. certsigningrequest for [email protected] This Apple ID's certificate request file (corresponding private key is KERISTEF), the certificate is generated under the Apple ID Chenjin, proves that certsigningrequest can be randomly generated, and validates what is said in the tutorial

3. Export the APNs certificate file and organize it into PEM format, in the Keyaccess utility, select both the certificate and the private key, right-click Export to P12 format file (need to specify the private key protection password, this protection password will be used when the message is sent provider) Then use the OpenSSL command to convert to PEM format

Apple-macb:simplepush apple$ OpenSSL pkcs12-in salemaster_apns_dis.p12-out salemaster_apns_dis.pem-nodes

Enter Import Password:

MAC verified OK

4, create Provisionprofile, respectively, Dev and dis version of the dev version for example, pay attention to choose the correct AppID, certificate select Dev Developer certificate, equipment attention to choose their own development equipment

5. Choose the right codesign and profile in Xcode

6. Add push message processing code, refer to various tutorials on the web

7, debugging simulation, using simplepush.php as a simulated push message server, see below to download these Simplepush code and unzip, you need to make some changes in simplepush.php.

Write your device ID here (no spaces): $deviceToken = ' 0f744707bebcf74f9b7c25d48e3358945f6aa01da5ddb387462c7eaf61bbad78 ';

The password is placed here $passphrase = ' pushchat ';

Put your push message here: $message = ' My first push notification! '; You need to copy device tokens from the app to the $devicetoken variable. Make sure to delete the space and the delimiter. It should be a 64-bit hexadecimal character. Put your private key passphrase into the $passphrase variable, and the information you want to send to the $message.

Copy your Ck.pem file to the Simplepush directory, and remember that this CK.PEM file contains both your certificate and your private key.

Then open a terminal and type:

$ PHP simplepush.php

You will receive a message on your phone shortly after execution of the above command, such as:

Apple iOS APNs message push notifications

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.