Repeat HMTimerTrigger On multiple days (Ex: Every Monday,Wednesday.... like in iOS 10 Home app) Repeat HMTimerTrigger On multiple days (Ex: Every Monday,Wednesday.... like in iOS 10 Home app) objective-c objective-c

Repeat HMTimerTrigger On multiple days (Ex: Every Monday,Wednesday.... like in iOS 10 Home app)


This functionality is not available to the public even though Apple has it in their HomeKit app. The best you could do is create multiple triggers for each day but then the user would gets confused.

Please open up a radar bug on it here


Few years back i did same thing using notification. You cannot create multiple trigger with one instance. So you have to create it for each day. I hope this example may give you some idea.

NSCalendar *calendar = [NSCalendar autoupdatingCurrentCalendar] ;NSDateComponents *componentsForReferenceDate = [calendar components:(NSYearCalendarUnit | NSWeekCalendarUnit |  NSHourCalendarUnit | NSMinuteCalendarUnit| NSSecondCalendarUnit | NSWeekdayCalendarUnit) fromDate:[NSDate date]];NSDate *referenceDate = [calendar dateFromComponents:componentsForReferenceDate] ;NSDateComponents *componentsForFireDate = [calendar components:(NSYearCalendarUnit | NSWeekCalendarUnit |  NSHourCalendarUnit | NSMinuteCalendarUnit| NSSecondCalendarUnit | NSWeekdayCalendarUnit) fromDate: referenceDate];NSArray *arrayDays = [NSArray arrayWithObjects:@"1",@"3",@"5", nil];for (int i=0; i<[arrayDays count]; i++){    // set components for time 2:00 p.m.    [componentsForFireDate setWeekday:[[arrayDays objectAtIndex:i] intValue]];    [componentsForFireDate setHour: 14];    [componentsForFireDate setMinute:0];    [componentsForFireDate setSecond:0];    NSDate *firstDateOfNotification = [calendar dateFromComponents: componentsForFireDate];    UILocalNotification *notification1 = [[UILocalNotification alloc]  init] ;    notification1.fireDate = firstDateOfNotification;    notification1.timeZone = [NSTimeZone localTimeZone] ;    notification1.alertBody = [NSString stringWithFormat: @"Complete your daily survey"] ;    notification1.alertAction = @"go back";    notification1.repeatInterval= NSWeekCalendarUnit;    notification1.soundName = UILocalNotificationDefaultSoundName;    [[UIApplication sharedApplication] scheduleLocalNotification:notification1] ;}