中处理聊天应用程序的远程通知

中处理聊天应用程序的远程通知

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

问题描述

我正在构建一个聊天消息应用程序,当用户收到来自发件人的消息时,我在处理推送通知时遇到了问题.

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

和Whatsapp一样,在我收到推送通知并打开飞行模式后,我打开应用程序仍然可以看到消息内容.所以,我相信它在收到通知时已经收到了消息.

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

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

I cannot find a good way to handle the remote chat message push notification when the user opens the app through its icon on the home screen instead of pressing or doing another action on the notification.

我在应用程序出现时手动加载了消息,但这与 Whatsapp 上的测试行为不同.我试过这个第三方socket库,但是一旦应用关闭,iOS就杀死了监听服务,不适用于什么我想建.

I manually loaded the message when the app did apear, but this is not like the tested behavior on Whatsapp.I tried this third party socket library, but iOS killed the listening service once the app was 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 if this is only allowed for VoIP providing apps. Does anyone know if Apple will accept my app to be published to their AppStore if I use the PushKit for only text messaging?

一个不切实际的问题,Whatsapp 怎么能做到这一点?它也使用 PushKit 吗?

The untimate question, how can Whatsapp achieve this? Does it use 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 中处理聊天应用程序的远程通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 05:09