系统应用'提醒'可以设置重复和结束重复,但iOS 10 UserNotification.framework
不支持此功能。
我使用UNCalendarNotificationTrigger
来推送本地通知。如何实现重复和结束重复功能?感谢。
let dateC = Calendar.current.dateComponents([.day, .hour, .minute], from: startDate!)
let trigger = UNCalendarNotificationTrigger(dateMatching: dateC, repeats: true)
let content = UNMutableNotificationContent()
content.title = "title"
content.body = "body"
let request = UNNotificationRequest(identifier: testIdentifier, content: content, trigger: trigger)
center.add(request) { (error) in
if let error = error {
print(error)
return
}
print("scheduled")
}