현재 내 코드가 작동하지 않습니다. 여전히 수동으로 새로 고쳐야합니다. 12 시간마다 자동으로 업데이트하고 싶습니다.Apple Watch 합병증을 자동으로 업데이트하는 방법은 무엇입니까?
func getTimelineStartDate(for complication: CLKComplication, withHandler handler: @escaping (Date?) -> Void) {
let date = Calendar.current.startOfDay(for: Date())
print("timeline start date :\(date)")
handler(date)
}
func getTimelineEndDate(for complication: CLKComplication, withHandler handler: @escaping (Date?) -> Void) {
var date = Calendar.current.startOfDay(for: Date())
date = Calendar.current.date(byAdding: .day, value: 2, to: date)!
print("timeline end date:\(date)")
handler(date)
}
func getNextRequestedUpdateDate(handler: @escaping (Date?) -> Void){
handler(Date(timeIntervalSinceNow: 60*60*12))
}