How To delete Event from Iphone Calendar Programmatically?
I am trying to delete Event From Iphone Calendar tell me how to delete Event From Iphone Calendar Programmatically
Here Is the way to add event in iphone calendar
////// Saving Event In Calendar
EKEventStore *eventStore = [[EKEventStore alloc] init];
EKEvent *event = [EKEvent eventWithEventStore:eventStore];
event.title = appDelegate.title1;
event.startDate = appDelegate.selecteddatafromcalendar;
event.endDate = [[NSDate alloc] initWithTimeInterval:600 sinceDate:event.startDate];
[event setCalendar:[eventStore defaultCalendarForNewEvents]];
NSError *err;
[eventStore saveEvent:event span:EKSpanThisEvent error:&err];
////// Saving Event In Calendar
I am trying to delete Event On user Request
and also tell me how to get event Id
// Deleting Event
EKEventStore *eventStore = [[EKEventStore alloc] init];
EKEvent *event = [EKEvent eventWithEventStore:eventStore];
event.title = appDelegate.title1;
event.startDate = appDelegate.recAddDate;
event.endDate = appDelegate.currentDateName;
[event setCalendar:[eventStore defaultCalendarForNewEvents]];
NSError *err;
[eventStore removeEvent:event span:EKSpanThisEvent error:&err];
Below is the function i m calling To remove Event From Event Array Items array is used to fetch events from Iphone calendar
- (BOOL)removeEvent:(EKEvent *)event span:(EKSpan)span error:(NSError **)error{
VoiceRecorderAppDelegate *appDelegate = (VoiceRecorderAppDelegate *)[[UIApplication sharedApplication] delegate];
[items removeObjectAtIndex:appDelegate.objectindexpath];
}