我已经用 1 个视图控制器启动了一个应用程序。在应用程序委托中,我想在应用程序启动后将通知发送 1 分钟
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.viewController = [[phil_croweViewController alloc] initWithNibName:@"phil_croweViewController" bundle:nil];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
NSDate *mydate = [NSDate date];
NSTimeInterval secondsInEightHours = 60;
NSDate *dateOneMinsAhead = [mydate dateByAddingTimeInterval:secondsInEightHours];
timeInTwoMinutes = [NSDateFormatter localizedStringFromDate:dateOneMinsAhead dateStyle:NSDateFormatterShortStyle timeStyle:NSDateFormatterShortStyle];
UILocalNotification *localNotif = [[UILocalNotification alloc] init];
localNotif.fireDate = dateOneMinsAhead;
localNotif.timeZone = [NSTimeZone defaultTimeZone];
localNotif.alertBody = @"alert";
localNotif.alertAction = @"View";
localNotif.soundName = UILocalNotificationDefaultSoundName;
localNotif.applicationIconBadgeNumber = 1;
// Schedule the notification
[[UIApplication sharedApplication] scheduleLocalNotification:localNotif];
NSLog(@"alert scheduled");
return YES;
}
除了 applicationBadgeNumber 没有显示 1 之外,这工作正常。我想了解 applicationBadgeNumber 的作用吗?是红色圆圈里面有数字吗??