1
- (void) scheduleGeneralNotificationFrequentlyWithItem:(ToDoItem *)item interval:(int)minutesBefore frequent:(NSCalendarUnit)frequentUnit{
NSCalendar *calendar = [NSCalendar autoupdatingCurrentCalendar];
NSDateComponents *dateComps = [[NSDateComponents alloc] init];
[dateComps setDay:item.day];
[dateComps setMonth:item.month];
[dateComps setYear:item.year];
[dateComps setHour:item.hour];
[dateComps setMinute:item.minute];
NSDate *itemDate = [calendar dateFromComponents:dateComps];
[dateComps release];
UILocalNotification *localNotif = [[UILocalNotification alloc] init];
if (localNotif == nil)
return;
localNotif.fireDate = [itemDate dateByAddingTimeInterval:-(minutesBefore*60)];
localNotif.timeZone = [NSTimeZone defaultTimeZone];
if (!item.eventName) {
item.eventName = @"My event name";
}
localNotif.alertBody = item.alertBody;
localNotif.alertAction = NSLocalizedString(@"Details", nil);
localNotif.soundName = UILocalNotificationDefaultSoundName;
localNotif.applicationIconBadgeNumber = 1;
localNotif.userInfo = item.data; // some data
localNotif.repeatInterval = frequentUnit; // here I put NSDayCalendarUnit
[[UIApplication sharedApplication] scheduleLocalNotification:localNotif];
[localNotif release];
NSString *isDisableLocalPush = [Settings getSetting:kPraktijDisableLocalPushKey];
if ([isDisableLocalPush isEqualToString:kJSONValueYes]) { //disable all notifications after added it
[self disableAllLocationPushNotifications];
}
}
위의 코드에서 localNotif.fireDate까지 매일 일정을 잡으시겠습니까?미래의 날짜 범위에서 지역 알림 일정을 잡으십시오.
내가 무엇을 달성하기 위해 시도하고있다 : 한 달에 다음 중 하나 달에 매일 일정 알림 예 : 2013년에서 2013년까지/월/01 일 통지/수도/01