我知道如何在 AppDelegate 的 applicationDidEnterBackground 函数中发出本地通知。
- (void)applicationDidEnterBackground:(UIApplication *)application
{
UILocalNotification * uln = [[UILocalNotification alloc] init];
uln.fireDate = [NSDate dateWithTimeIntervalSinceNow:10];
uln.timeZone = [NSTimeZone defaultTimeZone];
uln.alertBody = @"Did you forget something?";
uln.alertAction = @"Show me";
uln.soundName = UILocalNotificationDefaultSoundName;
//uln.applicationIconBadgeNumber = 0;
uln.repeatInterval = NSMinuteCalendarUnit;
application.scheduledLocalNotifications = [NSArray arrayWithObject:uln];
}
但是,用户是否可以为 fireDate 设置一个时间,并设置一个请勿打扰的时间,比如午夜晚些时候?