简体   繁体   中英

iOS React to push notifications when app is killed

I created a simple chat application that sends push notifications to the receiver when he's offline.

As I said in the title, when the app is killed I can't deliver the message correctly via a push notifications. Actually, when the iPhone recevives the push notification and the app is killed, even application:didReceiveRemoteNotification:fetchCompletionHandler is not triggered (as found in the other examples and apple documentation).

However, my app doesn't do any different from whatsapp, but still if I send a push notification via whatsapp even when it is killed the receiver will get his message delivered correctly.

How is this even possible

I read about PushKit and its VOIP push notification mode, but i want to understand if Whatsapp really use this functionality and, if I would use it, will my app risk to be rejected from Apple?

Thanks in advance.

UPDATE:

The test that i did with whatsapp is the following:

  1. Whatsapp on iPhone killed;
  2. Another device send me a message on Whatsapp;
  3. My iPhone receives the Push Notification;
  4. Activate airplane mode on iPhone;
  5. Open Whatsapp with icon app (not with tap on push notification);

Result: The message is correctly there. That makes me think that there is no sort of synchronization when Whatsapp starts but the message data is already delivered on the iPhone.

How is this possible if I can't react to a Push Notification if my app is forced killed?

@BjørnRuthberg 通过 VOIP 通知解决了这个问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM