0
我已經爲我的應用程序創建了一個區域設置通知,每天都會觸發,同樣在蘋果開發人員文檔中提到您只能觸發64個通知,所以我的問題是如何防止此限制?我的意思是我的通知計劃每年每天都會發生火災,那麼取消通知然後再按照計劃重新啓動的方法是正確的嗎?取消UILocaleNotification的問題
- (void)cancelLocalNotification:(UILocalNotification *)notification {
[[UIApplication sharedApplication] cancelLocalNotification:notification;
}
這裏是我的通知碼:
- (void) notification {
NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSPersianCalendar];
NSDate *now = [NSDate date];
NSDateComponents *componentsForFireDate = [calendar components:(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit| NSSecondCalendarUnit) fromDate: now];
[componentsForFireDate year];
[componentsForFireDate month];
[componentsForFireDate day];
[componentsForFireDate setHour:1];
[componentsForFireDate setMinute:2];
[componentsForFireDate setSecond:1];
NSDate *fireDateOfNotification = [calendar dateFromComponents: componentsForFireDate];
UILocalNotification *notification = [[UILocalNotification alloc]init];
notification.fireDate = fireDateOfNotification;
notification.timeZone = [NSTimeZone localTimeZone];
notification.repeatInterval= NSDayCalendarUnit;
notification.alertAction = @"View";
notification.soundName = UILocalNotificationDefaultSoundName;
[[UIApplication sharedApplication] scheduleLocalNotification:notification];
}
感謝它只是解釋了限制!我沒有找到任何具體的代碼或東西 – 2012-04-17 06:53:14
示例代碼在那裏。請參閱下面的鏈接,請參閱示例代碼部分。 – akk 2012-04-17 07:01:03
我更新了我的答案 – akk 2012-04-17 07:07:21