Ultimate Solution to iOS push

Source: Internet
Author: User
Tags key string ssl certificate
Ultimate Solution to iOS push

I have just created an application that uses the push function and encountered some problems. I am very depressed. After two days, I have figured it out. I would like to share it with you.

This post focuses on some issues related to the product release version. Based on some information on the Internet, you can refer to the test.

First of all, I would like to thank those sharing-minded experts for their contributions so that this newbie can bring the push function online from scratch.

As for the principles of the push function, I will not talk about it. There are a lot of information about the push on the Internet. However, there are a lot of materials I have written, I don't know why, but I can still understand the principles.
Here is an English post link http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12
English Translation http://article.ityran.com/archives/194
For the first time, I was able to translate the original English post into Chinese. However, I feel that I have not tried it myself, but I have implemented it.

Here I am talking about what I think is more important.

1. Key string generation request problems when you create a new application with the push function, it is best to regenerate a key string request to save trouble.
When you generate a key string request, make sure that the CRS file is retained. More importantly, when you generate this key string request, a pair of keys will appear in the key string. Note that the pair is the
The. p12 file exported in the post refers to the export file of the private key of the key just now.
(I don't know how to post the image. You can refer to the pictures in the two posts)

2. The unique identifier of the app ID cannot be used as a wildcard. However, the same application test and release can use the same identifier.

3 apns address
Test addressGateway.sandbox.push.apple.com: 2195 
Release addressGateway.push.apple.com: 2195
These two are different, of course, the certificate is also

4. I am depressed by this order.
Generate a key string request to download the development certificate and publish the certificate (preferably all together) "configure the app ID, configure both the Development SSL and the production SSL, download the SSL Certificate", and finally download the provisioning certificate.

Make sure that this sequence key CRS file matches the certificate that must be downloaded and published first. Otherwise, the client cannot receive the pushed certificate.

5. Real machine testing
During development, we usually use xcode to directly enter the device. At this time, the development certificate can be pushed successfully, but the production certificate cannot be pushed.
However, Apple provides us with the ad hoc test method. It uses the release certificate. If you do not know the ad hoc mode, you can search for it easily.
The key here is that the token obtained by development and production is different.
If you use the ad hoc method to install it on a device, you get the production token. Therefore, if you are using the ad hoc method to test the function, you must use the production token.
If you use the ad hoc method for testing, this release will be okay.

Another problem is that the token will be updated. This is mentioned in the official document. It means that Apple's server may update the device's token at a certain time or when the flash is not frequently used.
Here you need a mechanism to solve this problem.
My solution is to update the application version and regularly Delete tokens that take a long time for the server.
This will certainly cause some users who do not have updates and cannot receive the push. However, as long as the user is updated in real time, there will be no problem. This is a lazy way.
Because my application is onlyProgramThis will not be uploaded after the first upload, which can reduce the load on the server.
However, if you are a pushing application that is frequently pushed, you can frequently obtain frequently updated server records based on the situation.

A few simple points may not be clearly described here. Please forgive me. If you need help, please contact my Sina Weibo @ a thoughtful cabbage.

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.