0

我在Swift 3中为iOS 10做了一个应用程序。我做了一个UNNotificationContent来模拟我的应用程序中的一个调用,但它在启动后大约五秒钟后消失。我需要保持更多的秒数,而“呼叫”正在进行中。我想保留本地通知,直到我调用removeAllPendingNotificationRequests方法。我可以做吗?保留UNNotificationContent几秒

这是我现在的代码:

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) 

谢谢!

回答

0

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