简体   繁体   English

消息应用程序的iOS推送通知

[英]IOS Push notification for messaging app

I am working with a messaging app and the app needs to receive the notification from the server (chat message). 我正在使用消息传递应用程序,该应用程序需要从服务器接收通知(聊天消息)。 I am facing the problem when receiving the silent notification, most of the notification can't received by the device, the scenario as below: 我收到静默通知时遇到问题,设备无法接收大多数通知,情况如下:

  1. iOS 10 – Bring the app into background and push the silent notification, all notification can receive by the device. iOS 10 –将应用程序置于后台并推送静默通知,设备可以接收所有通知。

  2. iOS 11 – Bring the app into background and push the silent notification, device only can receive first 10 notifications and the rest of the notification disappear, I try to reboot the device and put the app into the background, able to receive another few notification and after that all not receive again. iOS 11 –将应用程序置于后台并推送静默通知,设备仅能接收前10条通知,其余通知消失,我尝试重新启动设备并将应用程序置于后台,能够接收到另外几条通知,在那之后所有都不会再收到。

  3. Both iOS 10 and 11 – Kill the app and push the silent notification, all the notifications not receive. iOS 10和11 –杀死应用程序并推送静默通知,所有通知都不会收到。

     func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { logging(cls: self, mod: "APP", msg: "Did receive remote notification") } 

I try the Whatsapp push notification, even I kill the app and turn off the background app refresh in setting, all the notification still come in, I'm curious how Whatsapp handle the push notification? 我尝试使用Whatsapp推送通知,即使我终止了该应用程序并在设置中关闭了后台应用程序刷新,所有通知仍会传入,我很好奇Whatsapp如何处理推送通知?

How do I solve this notification issue? 如何解决此通知问题?

Ideally you should use XMPP server base for live chat. 理想情况下,您应该使用XMPP服务器库进行实时聊天。

XMPP server has RTC ( Real time communication ) protocol, where 2 or more parties can connect, exchange document, live chat, video call, audio call etc. XMPP服务器具有RTC(实时通信)协议,其中2个或更多方可以连接,交换文档,实时聊天,视频通话,音频通话等。

You can also integrate websocket, for knowing user is online / office and other activities. 您还可以集成websocket,以了解用户在线/办公室等活动。

Integrating apple push, is not a 100% solution for live chat app like whatsapp, facebook messager, skype etc. 集成Apple Push,不是whatsapp,facebook messager,skype等实时聊天应用程序的100%解决方案。

Get more information about Pushkit 获取有关Pushkit的更多信息

From iOS 8, Apple introduced a new kind of push notification service called VoIP push. 从iOS 8开始,Apple推出了一种新的推送通知服务,称为VoIP推送。 VoIP push is provided by the Apple's PushKit framework. VoIP推送由Apple的PushKit框架提供。

Normal push notification service has the following drawbacks , 普通的推送通知服务具有以下缺点

  • Delivery: Apple doesn't promise a delivery time or priority. 交付:Apple不承诺交付时间或优先级。
  • Need permission to send push: Not all users understand that they need to allow it to receive calls. 需要发送推送的权限:并非所有用户都了解他们需要允许它接收呼叫。
  • The app doesn't know about a push until the user decides to act on the push. 在用户决定对推送进行操作之前,该应用才知道推送。
  • Apple might throttle your push messages if you send too many. 如果发送过多,Apple可能会限制您的推送消息。

Now coming to PushKit framework, 现在进入PushKit框架,

The benefits of PushKit framework are, PushKit框架的好处是,

  • You don't need to allow push; 您无需允许推送; it works without the user knowing about it. 它在用户不知道的情况下起作用。
  • Apple promises to deliver these push notifications high priority. 苹果承诺将高度优先地提供这些推送通知。
  • Your push notifications won't get lost. 您的推送通知不会丢失。
  • You have total control over push notifications. 您可以完全控制推送通知。

So, for messaging apps like yours, the usage of PushKit framework is recommended. 因此,对于像您这样的消息传递应用程序,建议使用PushKit框架。 Here is a tutorial on Github which explains how to implement PushKit in your apps. 这是有关Github的教程 ,介绍了如何在应用中实现PushKit。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Firebase Cloud Messaging iOS:无后台推送通知 - Firebase Cloud Messaging iOS: No background push notification GCM(Google Cloud Messaging)将通知从python应用服务器推送到iOS应用 - GCM (Google Cloud Messaging) push notification from python app server to iOS app 如何在 iOS 消息应用程序的推送通知中显示带有应用程序图标图像的消息发件人图像 - How to display message sender's image with app icon image for push notification of an iOS messaging app 未收到通过 iOS 应用程序中的 firebase 云功能发送的推送通知,尽管我从消息控制台获取 - Not receiving push notification sent via firebase cloud functions in iOS app though I get the from messaging console 在iOS应用中为Gmail推送通知 - Push notification for gmail in iOS app ios 推送通知终止应用程序 - ios push notification terminates app 推送即时消息的通知 - Push notification for instant messaging Flutter FCM 推送通知未在 IOS 上接收到 firebase_messaging:^9.1.3 - Flutter FCM push notification not receiving on IOS with firebase_messaging: ^9.1.3 使用php的iOS的苹果推送通知和android的google cloud消息传递? - apple push notification for iOS and google cloud messaging for android using php? 在iOS和Android中使用亚马逊设备消息传递(推送通知服务) - Use of amazon device messaging (push notification service) in both iOS and Android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM