ios - UserNotifications related events
问题描述
I am working with an iOS app using UserNotifications.
When the user taps on a notification, this method is fired:
userNotificationCenter(_:didReceive:withCompletionHandler:)
I want to know if there is a method called when the notification arrives, independently of when the user reacts.
解决方案
Yes you can : https://developer.apple.com/documentation/usernotifications/unusernotificationcenterdelegate/1649518-usernotificationcenter Of course the app has to be open for that. you can not execute code if the app is closed. In some cases you can execute code if the app is in background but that required special authorisation.
推荐阅读
- css - vuetify v-select 样式:太大
- sql - 当有 6 个月的差距时,如果没有 6 个月的差距,则抓住一切,然后抓住一切 sql
- ios - 快速正确获取 UIView 旋转角度
- c# - 如果主数据库关闭,则连接到辅助数据库
- c# - C# .net core,不包含敏感信息的日志请求
- php - SwiftMailer - php 在邮件中附加 txt 文件
- javascript - yyyy-mm-dd 的正则表达式
- react-native - react-native-svg中的LinearGradient不起作用
- javascript - 几个 axios 请求后 HTTP 请求冻结几分钟
- scala - 通过来自 Scala 的 Cats 中的类型别名创建 Validation.valid