how to delete calendar events programmatically?
hi all,
In my app I want to delete all calendar events programmatically.Is there any way to delete all calendar events?I tried EKEventStore for this.It is returning NSArray when I am applying predicate but returning null for "EKEvent *event = [EKEvent eventWithEventStore:eventStore];". Can anyone know where I am going wrong and how i can achieve this?
my code is as follows:-
EKEventStore *eventStore = [[EKEventStore alloc] init];
EKEvent *event = [EKEvent eventWithEventStore:eventStore];
[event setCalendar:[eventStore defaultCalendarForNewEvents]];
NSError *err;
BOOL ans=[eventStore removeEvent:event span:EKSpanThisEvent error:&err];
thanks in advance!
Last edited by nuzhat; 10-26-2010 at 11:38 PM.
|