在 iOS 上未调用闪亮的 NotificationDelegate OnReceived [英] Shiny NotificationDelegate OnReceived not being called on iOS

查看:26
本文介绍了在 iOS 上未调用闪亮的 NotificationDelegate OnReceived的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们一直在使用 Shiny 框架 进行本地通知,它已经完成了我们需要的工作在 iOS 和 Android 上显示通知,点击后会打开应用.

We've been using Shiny framework for Local Notifications and it has done what we needed which is make a notification appear on iOS and Android that when tapped will open the app.

然而,INotificationDelegate 上的 OnReceived 方法永远不会在 iOS 上被调用.这一直是 IIRC 的情况,但并不是真正的问题,因为除了在 AppCenter 中跟踪它之外,我们不需要对 OnReceived 做任何事情.因此,修复它从来没有被优先考虑过.

However the OnReceived method on the INotificationDelegate never gets called on iOS. This has been the case forever IIRC but was of no real concern as we didn't need to do anything with the OnReceived except track it in AppCenter. Therefore fixing it never got prioritised.

最近我们一直在研究使用推送通知.我们没有使用 Shiny 的推送,而是使用我们自己的后端 WebApi 注册设备.

Recently we have been looking at using Push Notifications. We are not using Shiny's push and instead are registering the device using out our own backend WebApi.

我看到一个问题,如果我在我们的 ShinyStartup ConfigureServices 中调用 UseNotifications 扩展,我们的 ReceivedRemoteNotification 的 AppDelegate 覆盖不会被调用.我们希望继续使用 Shiny 进行本地通知,所以这是一个问题.

I am seeing a problem where our AppDelegate override of ReceivedRemoteNotification does not get called if i call the UseNotifications extension in our ShinyStartup ConfigureServices. We want to continue using Shiny for Local Notifications so this is a problem.

我想知道我们的本地通知接收委托没有被调用的问题是否与此问题有关.

I am wondering if the issue that means our local notification received delegate does not get called is related to this issue.

推荐答案

您正在使用 ReceivedRemoteNotification,它适用于旧"在前台捕获远程通知的方式.Shiny.Notifications 使用一个 UNUserNotificationCenterDelegate,我相信它可以拦截并停止该方法.您可以实现 Shiny 通知委托来处理通知或使用 Shiny.Push.AzureNotificationHubs.

You are using ReceivedRemoteNotification which is for the "old" way of catching remote notifications in the foreground. Shiny.Notifications uses a UNUserNotificationCenterDelegate which I believe intercepts and stops that method. You can implement the Shiny notification delegate to work with the notification or use Shiny.Push.AzureNotificationHubs.

您也可以使用:DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action completionHandler) 这是一种更好的方法来处理远程通知,因为后台处理需要它

You can also use: DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action completionHandler) which is a better method to handle remote notifications anyhow since it is needed for background processing

这篇关于在 iOS 上未调用闪亮的 NotificationDelegate OnReceived的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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