IOS6 and iOS7 handle push differences, resolving repetitive push,-(void) Application:didReceiveRemoteNotification:fetchCompletionHandl

Source: Internet
Author: User

If the reader already knows the basics of push, this article only solves some adaptation and compatibility issues. If you are not familiar with push, refer to the following articles

1. Overview of "IOS Push full resolution" (i) push
2. "IOS Push full resolution" (ii) Generate a push certificate, generate provisioning profile

3. "IOS Push full resolution" (iii) a minimalist demo. and test the push.

4. Add the push code to the IOS program

====================== Body =======================

The client needs to deal with three things:

1. Client is in the foreground. Usually the pop-up window iOS6-(void) Application:didreceiveremotenotification: called
IOS7-(void) Application:didReceiveRemoteNotification:fetchCompletionHandler: called
Therefore, in order to be compatible with iOS6. The usual practice is to call-(void) in-(void) Application:didReceiveRemoteNotification:fetchCompletionHandler: Application:didreceiveremotenotification: Method.


Push processing module to infer if the program is active [uiapplication sharedapplication].applicationstate = = uiapplicationstateactive.


And then infer if you need to pop up a dialog box.
2. Client is in the background. But still alive. The principle is the same as the first, pay attention to handle whether the frame.
3. The state of the client being killed. Enter the push message. Swipe (click) The push message to tune the client. IOS 6 call-(void) Application:didfinishlaunchingwithoptions: with Launchdictionary. It includes a push message.
Need to simply deal with it and get the real content [Launchoptions Objectforkey:uiapplicationlaunchoptionsremotenotificationkey]
IOS 7 Calls two methods later:
-(void) Application:didfinishlaunchingwithoptions:
-(void) Application:didReceiveRemoteNotification:fetchCompletionHandler:
So there's a pit. IOS7 above, the same push message may be processed repeatedly.

"Resolve": Because only iOS7 above will call-(void) Application:didReceiveRemoteNotification:fetchCompletionHandler: method.


So. In order to be compatible with iOS6: Only handle iOS6 in-(void) Application:didfinishlaunchingwithoptions:.

4. Today's app has a start diagram process. If the push message comes over. The app is exactly the kill state, and if it starts, it has a start diagram.


This push-pull app is processed directly by the push, not the box.
The first way to think of the solution is to stage the push message. Then display the push content after the start of the diagram. Note that when the start diagram is complete, use the Push module
[UIApplication Sharedapplication].applicationstate = = Uiapplicationstateactive is not good to use. Since the app should be active at this point, it needs to be framed.

So. A push module is required to support a force-not-frame interface.

IOS6 and iOS7 handle push differences, resolving repetitive push,-(void) Application:didReceiveRemoteNotification:fetchCompletionHandl

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.