저는 iOS 개발을 처음 사용했지만 앱을 만들었으며 (10AM)과 같은 특정 시간에 대한 일일 알림을 만들려고합니다. 내가 모바일 장치 시간을 오전 10 시로 설정하면 알림이 너무 많이 전송됩니다. 오전 10시에 지정된 특정 시간에 한 번만 로컬 알림을 실행하고 싶습니다. 매일이 작업을 반복하고 싶습니다. 매일 알림을 반복하는 가장 좋은 방법은 무엇입니까? 여기 신속하게 특정 시간에 로컬 알림을 트리거하는 방법 3
내 코드입니다func fire(){
let dateComp:NSDateComponents = NSDateComponents()
dateComp.hour = 10
dateComp.minute = 00
dateComp.timeZone = NSTimeZone.systemTimeZone()
let calender:NSCalendar = NSCalendar(calendarIdentifier: NSCalendarIdentifierIndian)!
let date:NSDate = calender.dateFromComponents(dateComp)!
let localNotificationSilent = UILocalNotification()
localNotificationSilent.fireDate = date
localNotificationSilent.repeatInterval = NSCalendarUnit.Day
localNotificationSilent.alertBody = "Started!"
localNotificationSilent.alertAction = "swipe to hear!"
localNotificationSilent.timeZone = NSCalendar.currentCalendar().timeZone
localNotificationSilent.category = "PLAY_CATEGORY"
UIApplication.sharedApplication().scheduleLocalNotification(localNotificationSilent)
}
가능 중복 ([SWIFT와 설정 시간에 매일 반복 지역 알림] http://stackoverflow.com/questions/30619998/repeating-local- 알림 - 일일 시간에 - 설정 - 시간 - 신속) – sanman