아래 코드를 사용하여 알림을 생성하고 있지만 어떻게 든 실행되지는 않습니다. 하나의 특정보기 컨트롤러를 열 때 실제로 트리거하기를 원하지만 지금까지는 아무 것도 실행되지 않습니다. 내 코드의 문제점은 무엇입니까?UILocalNotification이 작동하지 않습니다.
func notify() {
let notification = UILocalNotification()
notification.fireDate = Date()
notification.repeatInterval = .minute
notification.alertBody = "The alert body"
notification.alertAction = "enter text here"
UIApplication.shared.scheduleLocalNotification(notification)
}
나는 또한 애플 대리자에서이 라인이
: notification.fireDate = Date()
에 의해 과거에있을 것입니다 현재 시간에 fireDate
을 설정 때문에
application.registerUserNotificationSettings(UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil))
이것은 그 것이었다! 나중에 날짜를 조금 변경하면 다시 작동하여 알림을 보냈습니다. – Misha