EKEventStore *eventStore = [[EKEventStore alloc] init];
EKEvent *event = [EKEvent eventWithEventStore:eventStore];
event.title = appDelegate.title1;
NSLog(@"%@",event.title);
event.startDate = appDelegate.currentDateName;
NSLog(@"%@",event.startDate);
event.endDate = appDelegate.alertTime;
[event setCalendar:[eventStore defaultCalendarForNewEvents]];
NSLog(@"%@",event);
NSError *err;
//NSString *eventID;
//[eventStore eventWithIdentifier:eventID];
[eventStore removeEvent:event span:EKSpanThisEvent error:&err];
How to remove Iphone calendar Event Programmatically my code is given above
check my code
I want to remove event on user request appDelegate.title1 is the title of Event saving in IPhone calendar
need quick reply
i m trying this code event deleted from database but unable to remove event from calendar
I am saving event with the help code given below
//Create a Coffee Object.
Coffee *coffeeObj = [[Coffee alloc] initWithPrimaryKey:0];
NSString *abc=[[NSString alloc] initWithFormat:@"%@ Voice Reminder",recordsavetime];
coffeeObj.Name = appDelegate.filenamefrompath;
coffeeObj.CurrentTime = theremindertime;
coffeeObj.title1 =abc;
// coffeeObj.CurrentTime = stringFromDate( appDelegate.selecteddatafromcalendar);
coffeeObj.add_date = currentdatee;
coffeeObj.alert_time = thetime;
appDelegate.title1= abc;
appDelegate.currentDateName = theremindertime;
appDelegate.recAddDate = currentdatee;
appDelegate.alertTime = thetime;
////// 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
NSLog(@"%@ ",coffeeObj.Name);
coffeeObj.isDirty = NO;
coffeeObj.isDetailViewHydrated = YES;
//Add the object
[appDelegate addCoffee:coffeeObj];