Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How To delete Event from Iphone Calendar Programmatically?

Posted on 2010-09-07
1
Medium Priority
?
6,385 Views
Last Modified: 2012-06-21
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 

Open in new window



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];
	NSError *err;
	[eventStore removeEvent:event span:EKSpanThisEvent error:&err];

Open in new window




Below is the function i m calling To remove Event From Event Array
- (BOOL)removeEvent:(EKEvent *)event span:(EKSpan)span error:(NSError **)error{
	VoiceRecorderAppDelegate *appDelegate = (VoiceRecorderAppDelegate *)[[UIApplication sharedApplication] delegate];
	[items removeObjectAtIndex:appDelegate.objectindexpath];
}

Open in new window



My job is to remove Selected from Item Array


Kindly Check My code and Give Response As soon As possible
0
Comment
Question by:IamnotanExpert007
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 3

Accepted Solution

by:
IamnotanExpert007 earned 0 total points
ID: 33711264
well i found the answer
use there line when you are saving events
[eventStore saveEvent:event span:EKSpanThisEvent error:&err];
   NSString* str = [[NSString alloc] initWithFormat:@"%@", event.eventIdentifier];
[arrayofCalIDs addObject:str];



in order to delete event you there lines
event delete with the help of eventwithidentifier this is use to find event id from iphone calendar


EKEventStore* store = [[[EKEventStore alloc] init] autorelease];
   EKEvent* event2 = [store eventWithIdentifier:[arrayofCalIDs objectAtIndex:i]];
if (event2 != nil) {  
  NSError* error = nil;
  [store removeEvent:event2 span:EKSpanThisEvent error:&error];
}
[myPath release];


Problem solveD
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let Bitmoji into your life. Now is the time to learn a new language of smartphone messaging with this brief introduction.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question