Question

enable uilocalnotification Need to enable this notification schedules daily, I'm not getting, I created 3 different methods for each hour worked but it is not.

8:00 AM

12:00 AM

4:00 PM

-(void)Hour_08 {
    NSString *str = [NSString stringWithFormat: @"%@ 08:00", self.DayNow];
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"yyyy-MM-dd hh:mm"];
    NSDate *date = [dateFormatter dateFromString: str];

    UILocalNotification *OitoHorasNotification = [[UILocalNotification alloc]init];
    [OitoHorasNotification setFireDate:date];
    OitoHorasNotification.repeatInterval = NSDayCalendarUnit;
    [OitoHorasNotification setAlertBody:@"is now 08:00"];
    [[UIApplication sharedApplication]scheduleLocalNotification:OitoHorasNotification];

}
Was it helpful?

Solution

Have you taken a look at this site as it suggests you use NSHourCalendarUnit instead of NSDayCalendarUnit which would be the case if you performing notifications after whole days. Or Maybe you are performing Notifications for whole days and therefore your code would be correct I would of miss read you question

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top