It's not hard to integrate a push in an iOS client, and with the official documentation and demo, there are several important timing diagrams that run several times and probably know how to write the code.
Here's a recap of the push code flow based on your own understanding:
1, create a push SKD object, SKD will send ClientID to a push server, and asynchronously return ClientID. A push server uses ClientID to uniquely identify each device, and after receiving ClientID, you can upload clientid and user information to the app server.
2, to Apple Server registration APNs, received Devicetoken, call a push SKD method will devicetoken and ClientID binding.
3, the app server can use ClientID to push information to the device: (1) If the app is in the foreground, the information will be transferred from the app server to a push server, by a push server to find the corresponding device through ClientID. (2) If the app switches to the background, this time the Push SDK is turned off, push the message through APNs, Devicetoken to find the corresponding device.
Push SDK calls are recommended in the main thread to ensure thread safety.
The next point is to keep a record of where I'm going:
1, a push release environment and the development environment to upload different certificates, the app installed with the release certificate cannot receive the push message of the development environment certificate.
2. It takes 24 hours to replace the development certificate and publish the certificate, the reason: When the new certificate comes into effect, there will be a new devicetoken, but the pit dad's push is actually going to be 24 hours apart before the ClientID and Devicetoken will be re-bound, So this time ClientID does not map to the correct devicetoken, so the background push cannot succeed. WORKAROUND: You can register two tweets with one app, upload different certificates, use different appkey, so you don't need 24 hours of waiting.
3, through the message: is said to be a custom message, distinguish between ordinary notifications.
Summary of Push usage