오후 9시에 발생하고 일주일에 한 번 반복하도록 로컬 알림을 예약하려고합니다. 다음 코드가 있는데 "NSDateComponents 형식의 값을 .fireDate에 할당 할 수 없습니다 .fireDate는 NSDate 형식 만 수락하지만 시간 변수와 분 변수를 설정하는 방법을 찾을 수는 없습니다."라는 오류 메시지가 계속 나타납니다. 있는 NSDate 유형에 대해 나는이 작업을 수행 할 수 있다고 생각하지 않기 때문에특정 시간에 대한 로컬 알림 설정
func Notification(){
let dateComponents = NSDateComponents()
dateComponents.day = 4
dateComponents.month = 7
dateComponents.year = 2016
dateComponents.hour = 21
dateComponents.minute = 00
let Notification = UILocalNotification()
Notification.alertAction = "Go Back To App"
Notification.alertBody = "Did you complete your HH and QC?"
Notification.repeatInterval = NSCalendarUnit.WeekOfYear
Notification.timeZone = NSTimeZone.defaultTimeZone()
Notification.fireDate = dateComponents
UIApplication.sharedApplication().scheduleLocalNotification(Notification)
}
구글 캘린더 방법 dateFromComponents 에 근무 –