我想做点什么。我的通知设置为 11 和 12 小时。我想取消订阅这些设置的通知仅在 11 小时内。我该怎么做?
我的代码;
NSCalendar *greg = [[NSCalendar alloc]initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents * component = [greg components:NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit fromDate:[NSDate date]];
[component setYear:2013];
[component setMonth:m];
[component setDay:d];
[component setHour:x];
[component setMinute:y];
UIDatePicker *dd = [[UIDatePicker alloc]init];
[dd setDate:[greg dateFromComponents:component]];
UILocalNotification * bildirim = [[UILocalNotification alloc]init];
[bildirim setAlertBody:newtask.name];
[bildirim setFireDate:dd.date];
bildirim.soundName = UILocalNotificationDefaultSoundName;
bildirim.alertAction = NSLocalizedString(@"Test", nil);
//[bildirim setFireDate:[NSDate dateWithTimeIntervalSinceNow:0]];
[bildirim setTimeZone:[NSTimeZone defaultTimeZone]];
[[UIApplication sharedApplication] scheduleLocalNotification:bildirim];
我找到了一个代码。不幸的是,此代码正在删除所有通知。
[[UIApplication sharedApplication] cancelAllLocalNotifications];
对不起,我的英语不好。