About the ultimate solution to the iOS push feature

Source: Internet
Author: User
Tags ssl certificate

Just made a use of the push function of the application encountered a number of problems the whole very depressed engaged for two days finally is to understand to share to everyone


This post is mainly for the release of some of the issues of the product to synthesize some information on the web according to their own practice, but the test can also see


First of all, to thank those who share the spirit of the contribution of the people to make me this novice can push the function from zero to the whole line.


As for the principle of push, I'm not going to talk about it. There's a lot of information about push on the web, but there are a lot of them that don't know why, but the principle can be figured out.
A link to an English post is attached http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12
Chinese translation http://article.ityran.com/archives/194
The first time I was looking at the English original post Chinese translation is also very good but feel that the author did not personally tried I but realized oh.


Here I say I think the more critical place

1 Generating Keychain Request problems It's best to regenerate the keychain request when you make a new app with push functionality. The Province of Chaos
When you generate a keychain request, the CRS file must be kept, and more importantly, you'll get a couple of keys in the keychain when you generate the keychain request. It's important to note that the pair is just appearing.
In the post, the export of the. p12 file refers to the export file for the private key of the key that was just
(This does not know how to paste the picture, you can refer to the two posts inside the figure)

2 must be unique identifier app ID cannot be used with wildcards this is not negotiable. But the same application test and release can use the same identifier.


3 APNs Address
Test Address gateway.sandbox.push.apple.com:2195
Post Address gateway.push.apple.com:2195
These two are different, of course the certificate is also


4 order I was depressed by this order.
Generate Keychain Request Download Development certificate and publish certificate (preferably all together) "Configure the app ID to configure the development SSL and production SSL to download the SSL certificate" and finally download the provisioning certificate.
Be sure to have this order key CRS file must match in the download release certificate must first put the published SSL certificate under the good otherwise the push succeeds the client will not receive the problem.


5 Real-Machine testing
The development of the general we are using Xcode directly into the device at this time development certificate can be pushed successfully, but production certificate is not able to push
But Apple has provided us with ad hoc testing methods it uses a publishing certificate if you don't know the ad hoc mode you can search very simple
Here's a key place where development and production get tokens that are not the same
Using ad hoc to install to the device is production token so you are testing with ad hoc mode to use production token
If you use ad hoc mode test no problem This release is no problem.

Another problem is that token will be updated this is mentioned in the official documentation that the Apple server may update the token of the device for a certain amount of time or if the machine does not appear regularly
Here's a mechanism you need to solve this problem
My solution is to update the application version and then periodically delete the server for a longer time token
This will certainly cause some non-updating users to not receive the push issue but as long as he updates it immediately, no problem. It's a lazy way.
Because my application is only uploaded once when the program first opens, it will not be transmitted. This reduces the load on the server.
But you're a push. Frequent update service-side records are frequently used that's according to the situation.

Just a few simple points to write about here, there may be some areas that are not clearly described, please forgive me if you need help contact my Sina Weibo @ a thought-minded cabbage



2013.03.01 Additional content:

Last time a classmate in front of the steps are no problem, the final verification when the following tips, pay attention to the red Line part, at the time he thought it was the certificate did not pass the verification, in fact, this is no problem.

[This post was edited by Lmyangwen on 2013-03-01 15:52] Picture: screenshot 2012-05-03 pm 6.18.16.png
Description: Certificate Validation
Image: Fa781775-8e66-45c4-8de1-96f417456dd0.png

About the ultimate solution to the iOS push feature

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.