Handle the remote notification for chat application in iOS

前提是你 提交于 2019-12-12 03:59:48

问题


Hi,

BACKGROUND

I am buidling a chat messaging applicaiton and I faced problem to handling push notificaton when user receiving message from the sender.IV

ACHIEVE

Like Whatsapp does, after I received the push notification and I turned on the airplane mode, I still can see the message contains while I open the app. so, I believe it has get the message while receiving the notification.

PROBLEM

I cannot find a good way to handle the remote chat message push notification when user open the app through app's icon on home screen instead of press or do other action on the notification.

TRIED

Manually load the message when the app did apear, but this is not like what I tested on Whatsapp does. I tried the third party socket library(socket.io), but iOS killed the listening service once the app closed, it is not applicable to what I want to build.

QUESTION

If still using the push notification or background mode remote notification, is that any way to able to handle the push notification when the app is not running ?

I also find out about the Apple PushKit, I not sure is this only allow for VoIP provided app? does anyone know will Apple accept my app publish to AppStore if I use the PushKit for only text messaging ?

the untimate question, how the Whatsapp can achieve this ??? does it using PushKit as well.

Thanks!!!


回答1:


Actually you can't handle something when your app is killed, so simple solution for you problem is to store all push notifications data in server , get it from server when you run app, and delete them once you got them. I think Whatsapp handle this in same way.




回答2:


Just search about XMPP server, for live chat there is no need for Pushkit, Pushkit is only for Video call notification when app is terminated.

Use XMPP server for live chat integration.

https://code.tutsplus.com/tutorials/building-a-jabber-client-for-ios-xmpp-setup--mobile-7190

What is XMPP, and how can I use it within an iOS chat application?



来源:https://stackoverflow.com/questions/44694711/handle-the-remote-notification-for-chat-application-in-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!