【发布时间】:2017-04-03 11:43:39
【问题描述】:
对于我的应用,我希望实现一个本地通知系统。
我安排通知的代码如下:
func scheduleNotification(_ Name:String, _ Time:DateComponents){
let center = UNUserNotificationCenter.current()
let notification = UNMutableNotificationContent()
notification.title = Name
notification.sound = UNNotificationSound.default()
var trigger = UNCalendarNotificationTrigger(dateMatching: Time, repeats: false)
let identifier = Name
let request = UNNotificationRequest(identifier: identifier, content: notification, trigger: trigger)
center.add(request)
}
现在昨天有效,但不再有效。在模拟器和设备中。
我已经尝试过这里的建议无济于事:Local Notifications make sound but do not display (Swift)
我尝试过的:
- 在应用强制关闭的情况下进行测试
- 在后台使用应用进行测试
- 更改标识符
【问题讨论】: