在屏幕上延长通知时间

时间:2016-10-30 06:08:31

标签: ios swift swift3 ios10 unusernotificationcenter

有没有办法在屏幕上延长通知时间直到通知声音结束?

我正在使用iOS 10.1,Swift 3.0

        let content = UNMutableNotificationContent()

        content.title = NSString.localizedUserNotificationString(forKey: "Hello", arguments: nil)
        content.body = NSString.localizedUserNotificationString(forKey: title, arguments: nil)
        var sound = "\(mySound)" + ".caf"
        content.sound = UNNotificationSound.init(named: sound)

        let trigger = UNCalendarNotificationTrigger(dateMatching: dateComp, repeats: false)

        let request = UNNotificationRequest(identifier: identifer, content: content, trigger: trigger) // Schedule the notification.

        let center = UNUserNotificationCenter.current()
        center.add(request)

0 个答案:

没有答案