当 iOS 设备锁定且我没有立即响应时接收远程通知

发布于 2024-11-29 20:55:25 字数 358 浏览 2 评论 0原文

我的应用程序正在接收远程通知 (APNS),并且适用于所有常见场景:

  • 应用程序未运行 (didFinishLaunchingWithOptions:)
  • 应用程序正在运行且处于活动状态 (didReceiveRemoteNotification:)
  • 应用程序正在运行,手机已锁定,我会尽快解锁设备当我收到通知时(didReceiveRemoteNotification:)

但是,如果我在最后一种情况下选择不立即解锁设备(使用滑块)并且我等到屏幕再次变黑,则不会。消息/通知仍然显示在锁定屏幕中,但滑块现在只能解锁设备,当我解锁时, didReceiveRemoteNotification: 根本不会被调用。

My app is receiving remote notifications (APNS) and is working for all the common scenarios:

  • App is not running (didFinishLaunchingWithOptions:)
  • App is running and active (didReceiveRemoteNotification:)
  • App is running, the phone is locked and I unlock the device as soon as I get the notification (didReceiveRemoteNotification:)

However, not if I in the last case choose not to unlock the device immediately (with the slider) and I wait until the screen goes black again. The message/notification is still shown in the lock screen, but the slider can now only unlock the device and when I do, didReceiveRemoteNotification: doesn't get called at all.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

北斗星光 2024-12-06 20:55:25

恐怕这是预期的行为。引用本地和推送通知编程指南部分< em>安排、注册和处理通知:

如果点击操作按钮 (...),系统将启动
应用程序并且应用程序调用其委托
application:didFinishLaunchingWithOptions: 方法 (…);它传入
通知有效负载 (...)。如果点击应用程序图标 (...),
应用程序调用相同的方法,但不提供任何信息
关于通知。

I’m afraid this is the intended behaviour. Quote the Local and Push Notification Programming Guide, part Scheduling, Registering, and Handling Notifications:

If the action button is tapped (…), the system launches the
application and the application calls its delegate’s
application:didFinishLaunchingWithOptions: method (…); it passes in
the notification payload (…). If the application icon is tapped (…),
the application calls the same method, but furnishes no information
about the notification.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文