毎日7:00に通知を鳴らしたいのですが、鳴りません。また、ロック画面に表示したいです。これが私がこれまでに持っているすべてのコードです。
-(void)EveryDayNotify
{
NSLog(@"Good Morning Working");
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
[localNotification setAlertBody:@"Good Morning! Have a great day!"];
localNotification.soundName = UILocalNotificationDefaultSoundName;
localNotification.applicationIconBadgeNumber = 1;
localNotification.repeatInterval = NSDayCalendarUnit;
NSCalendar *calendar = [NSCalendar currentCalendar]; // gets default calendar
NSDateComponents *components = [calendar components:(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit) fromDate:[NSDate date]]; // gets the year, month, day,hour and minutesfor today's date
[components setHour:07];
[components setMinute:0];
localNotification.fireDate = [calendar dateFromComponents:components];
[localNotification release];
}