나는 iOS 10 로컬 알림을 구현하려고 시도 했으므로 먼저 코드가 iOS 9와 동일한 알림 확장 타겟을 추가한다고 생각했습니다. 그러나 실제로는 UNMutableNotificationContent
클래스를 사용합니다.날짜 선택기를 사용하여 지역 UNMutableNotificationContent 발포 날짜
시간 간격을 사용하여 알림을 보내고 알림을 설정할 수 있지만 날짜 선택 도구를 사용하여 특정 화재 날짜를 구체적으로 설정할 수 있습니까?
import UserNotifications
let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .full
let displayDate = dateFormatter.string(from: datePicker.date)
let notif = UNMutableNotificationContent()
notif.title = "Reminder)"
notif.subtitle = "\(displayDate)"
notif.body = "Details"
notif.categoryIdentifier = "Details Reminder"
let notifTrigger = UNTimeIntervalNotificationTrigger(timeInterval: 5, repeats: false)
let request = UNNotificationRequest(identifier: "myNotif", content: notif, trigger: notifTrigger)
UNNotificationRequest
트리거 난 그냥 날짜를 추가 할 수 있습니다 기대했다 종류 UNTimeIntervalNotificationTrigger
이 필요합니다.
현재 날짜와 날짜 선택기 날짜를 사용하여 간격 시간을 조정해야합니까? 또는 다른 방법으로이 작업을 수행 할 수 있습니까?