我已经在MBCalender工具包的帮助下创建了自定义日历,现在我已经为某些特定日期添加了活动,如何为这些特定日期创建提醒?
答案 0 :(得分:0)
使用EKReminder
- (void)createReminder:(NSDate*) objDate {
EKReminder *reminder = [EKReminder
reminderWithEventStore:objEventStore];
// objEventStore is the object of EKEventStore if you create that global that will be good
reminder.title = @"title";
reminder.notes = @"note";
reminder.calendar = [objAppDelegate.eventStore defaultCalendarForNewReminders];
EKAlarm *alarm = [EKAlarm alarmWithAbsoluteDate:objDate];
[reminder addAlarm:alarm];
NSError *error = nil;
BOOL status = [objAppDelegate.eventStore saveReminder:reminder commit:YES error:&error];
if (status == NO) {
_strUDID = nil;
}
else {
_strUDID = [NSMutableString stringWithFormat:@"%@",reminder.calendarItemIdentifier];
}
}