gpt4 book ai didi

ios - 设备锁定时可以处理通知操作吗?

转载 作者:行者123 更新时间:2023-11-29 05:56:48 26 4
gpt4 key购买 nike

我已经使用通知有一段时间了,我可以发誓 userNotificationCenter(_:didReceive:withCompletionHandler:) 仅在应用程序通过以下方式打开时才会被处理通知。

但是,在查看 actionable notifications 后,我发现了这个:

When the user selects an action, the system launches your app in the background and notifies the shared UNUserNotificationCenter object, which notifies its delegate. Use your delegate object's userNotificationCenter(_:didReceive:withCompletionHandler:) method to identify the selected action and provide an appropriate response.

这是否意味着看似通用的 didReceive 委托(delegate)方法现在即使在设备锁定时也可以工作?

或者应用程序必须始终打开才能实际执行任何有意义的操作来响应通知操作(写入本地数据库、发送 HTTPS 请求等)?

最佳答案

是的,即使设备被锁定,代理也可以工作。仅当用户选择操作时应用程序才会被唤醒。另外,我不确定在调用完成 block 之前您将获得多少时间。

Important

If your response to action involves accessing files on disk, consider a different approach. Users can respond to actions while the device is locked, which would make files encrypted with the complete option unavailable to your app. If that happens, you may need to save changes temporarily and integrate them into your app's data structures later.

关于ios - 设备锁定时可以处理通知操作吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55074473/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com