处理iOS中聊天应用程序的远程通知 [英] Handle the remote notification for chat application in iOS

查看:128
本文介绍了处理iOS中聊天应用程序的远程通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景

我正在建立聊天消息传递应用程序,当用户从发件人接收消息时遇到处理推送通知的问题.IV

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

实现

就像Whatsapp一样,在收到推送通知并打开飞行模式后,我仍然可以在打开应用程序时看到该消息.因此,我相信它在收到通知的同时已经收到了消息.

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.

问题

当用户通过主屏幕上的应用程序图标打开应用程序而不是按通知上的其他操作或在通知上执行其他操作时,我找不到处理远程聊天消息推送通知的好方法.

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.

尝试

当应用确实出现时,手动加载消息,但这与我在Whatsapp上进行的测试不同. 我尝试了第三方套接字库(socket.io),但是一旦应用关闭,iOS就会终止监听服务,不适用于我要构建的内容.

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.

问题

如果仍在使用推式通知或后台模式远程通知,那么该方法是否可以在应用未运行时处理推式通知?

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 ?

我还找到有关Apple PushKit的信息,我不确定这是否仅允许VoIP提供的应用程序?有谁知道如果我仅将PushKit用于文本消息传递,Apple会接受我发布到AppStore的应用程序吗?

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 ?

一个不切实际的问题,Whatsapp如何实现这一目标???也可以使用PushKit.

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

谢谢!

推荐答案

只需搜索XMPP服务器,就可以进行实时聊天,无需使用Pushkit,Pushkit仅在应用终止时用于视频通话通知.

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.

使用XMPP服务器进行实时聊天集成.

Use XMPP server for live chat integration.

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

什么是XMPP,如何在iOS聊天应用程序中使用它?

这篇关于处理iOS中聊天应用程序的远程通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆