gpt4 book ai didi

ios - 保持 UNNotificationContent 几秒钟

转载 作者:行者123 更新时间:2023-11-28 06:31:01 25 4
gpt4 key购买 nike

我正在为 iOS 10 使用 Swift 3 开发一个应用程序。我在我的应用程序中做了一个 UNNotificationContent 来模拟调用,但它在启动后大约五秒钟就消失了。在“调用”过程中,我需要多留几秒钟。我想在调用 removeAllPendingNotificationRequests 方法之前保留本地通知。我可以吗?

现在这是我的代码:

let content = UNMutableNotificationContent()
content.body = "\(userName) is calling..."
content.sound = UNNotificationSound(named: "sound_call.wav")
content.badge = 1

let request = UNNotificationRequest(identifier: "notification", content: content, trigger: nil)
UNUserNotificationCenter.current().add(request)

谢谢!

最佳答案

无法控制通知在屏幕上停留的时间。那是系统控制的。

关于ios - 保持 UNNotificationContent 几秒钟,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40346256/

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