我已經與1個視圖控制器進行了應用程序。在應用程序的委託,我想應用啓動applicationBadgeNumber沒有設置
- (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做什麼shedule通知包1分鐘的時間?它是數字中的紅色圓圈?
檢查您的通知設置沒有禁用徽章。 –
這是在模擬器中,當我去模擬器theres設置沒有通知設置 – user987723
檢查設備 –