-(void)setNoti {
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
localNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:60];
localNotification.alertBody = @"NOTI 1";
localNotification.timeZone = [NSTimeZone defaultTimeZone];
localNotification.applicationIconBadgeNumber = [[UIApplication sharedApplication] applicationIconBadgeNumber] + 1;
localNotification.repeatInterval = kCFCalendarUnitMinute;
NSDictionary *dict = @{@"nid":@"1"};
localNotification.userInfo = dict;
[[UIApplication sharedApplication]scheduleLocalNotification:localNotification];
}
爲什麼我的簡單UILocalNotification沒有觸發?我的簡單UILocalNotification沒有觸發
打印localNotification.fireDate的值是否正確或不正確? – svrushal
你需要[應用程序cancelAllLocalNotifications];因爲通知是存儲第一個值。 – Rock