以下是我为每日本地通知撰写的一段代码:
UILocalNotification *localNotif11 = [[UILocalNotification alloc] init];
localNotif11.alertBody = @"Hello";
localNotif11.alertTitle=@"Reminder";
localNotif11.soundName=@"notification.caf";
NSDateComponents *components11 = [[NSCalendar currentCalendar] components:(NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitWeekOfMonth) fromDate:[NSDate date]];
[components11 setHour:11];
[components11 setMinute:00];
localNotif11.fireDate = [[NSCalendar currentCalendar] dateFromComponents:components11];
localNotif11.applicationIconBadgeNumber = [[UIApplication sharedApplication] applicationIconBadgeNumber] + 1;
NSLog(@"%@",localNotif11.fireDate);
[localNotif11 setRepeatInterval:NSCalendarUnitDay];
[[UIApplication sharedApplication] scheduleLocalNotification:localNotif11];
答案 0 :(得分:1)
试试这段代码:
id
你在现在直到约会时才会被激怒。