【发布时间】:2018-06-20 11:40:46
【问题描述】:
我有一个消息应用程序,我正在使用VoIP notifications 向用户发送确认。每次调用 PushKit delegate 时,我都会触发本地通知。
当前的情况是之前的通知被删除并被新的通知取代。有没有办法管理本地通知,以便用户可以在他们的设备中看到多个通知?
这是我尝试过的代码:
let notificationContent = UNMutableNotificationContent()
notificationContent.title = "Title"
notificationContent.subtitle = "Subtitle"
notificationContent.body = "Body"
// Add Trigger
let notificationTrigger = UNTimeIntervalNotificationTrigger(timeInterval: 0.01, repeats: false)
// Create Notification Request
let notificationRequest = UNNotificationRequest(identifier: "cocoacasts_local_notification", content: notificationContent, trigger: notificationTrigger)
// Add Request to User Notification Center
UNUserNotificationCenter.current().add(notificationRequest) { (error) in
if let error = error {
print("Unable to Add Notification Request (\(error), \(error.localizedDescription))")
}
}
P.S : 我不想在以后安排本地通知
【问题讨论】:
标签: ios swift localnotification pushkit