【问题标题】:Push notification received, but app closes收到推送通知,但应用程序关闭
【发布时间】:2019-09-26 17:04:25
【问题描述】:

我正在通过通知中心向 iOS 设备发送推送通知。成功收到通知。用户单击通知后,将显示启动画面,然后应用程序关闭。我检查了崩溃日志,没有任何错误。

如果我们查看控制台日志,最后一条消息是“Received incoming message on top xx at priority 10”。

日志前面有一条警告,指出“在 /var/mobile/Library/UserNotification/com.xxxx.xxx/PendingNotifications.plist 中找不到数据。

如果我直接从 Azure 门户(相同的设备和有效负载)发送通知,则会收到通知并按预期打开应用程序。

想法?

【问题讨论】:

标签: c# xamarin.ios azure-notificationhub


【解决方案1】:

当您通过单击通知打开应用程序时,会调用didFinishLaunchingWithOptions/ 或DidReceiveRemoteNotificationis。您应该添加一些日志打印以查看卡住的位置。

请查看this 线程以调试推送通知。

注意:如果推送通知到达时应用程序未运行,则应用程序将启动,但DidReceiveRemoteNotification 方法不会处理通知。相反,获取通知负载并从 WillFinishLaunchingFinishedLaunching 覆盖中做出适当的响应。

更多参考请访问:

https://docs.microsoft.com/en-us/xamarin/ios/platform/user-notifications/deprecated/remote-notifications-in-ios

希望对您有所帮助。

【讨论】:

    猜你喜欢
    • 2017-04-11
    • 1970-01-01
    • 1970-01-01
    • 2021-06-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-30
    • 1970-01-01
    相关资源
    最近更新 更多