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 の機能を理解していませんか? 番号が入った赤い丸です??