Tag: repeatingalarm

我的通知代码有什么错误?

注意:下面有一个更新。 在上一个问题中,我已经提出了每小时重复间隔指定一分钟的问题。 不过,我有两个答案要求我尝试date组件,而我做到了。 这里是: [[UIApplication sharedApplication] cancelAllLocalNotifications]; NSCalendar *calendar = [NSCalendar autoupdatingCurrentCalendar] ; NSDateComponents *componentsForReferenceDate = [[NSDateComponents alloc] init]; [componentsForReferenceDate setHour:hour]; [componentsForReferenceDate setMinute:0]; [componentsForReferenceDate setSecond:0]; NSDate *fireDateOfNotification = [calendar dateFromComponents: componentsForReferenceDate]; // Create the notification UILocalNotification *notification = [[UILocalNotification alloc] init] ; notification.fireDate = fireDateOfNotification; notification.timeZone = [NSTimeZone localTimeZone] ; notification.alertBody = [NSString stringWithFormat: @"You […]