【发布时间】:2012-12-09 22:02:16
【问题描述】:
我知道如何在 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 设置一个时间,并设置一个请勿打扰的时间,例如午夜晚些时候?
【问题讨论】:
标签: ios uilocalnotification appdelegate