How to edit calendar in iphone through programmatically
<p>I am developing one application in that i have collect the data from webService now i want to stored that particular information in to the calendar to respected date for that i write following code </p>

<pre><code>self.eventStore = [[EKEventStore alloc ] init ];

event  = [EKEvent eventWithEventStore:eventStore];

Detail *detail1=[DetailArray objectAtIndex:indexPath.row];

//-------------------------------------------------------   


// Get an array of all the calendars.
calendars = eventStore.calendars;

// Get the default calendar, set by the user in preferences.
EKCalendar *defaultCal = eventStore.defaultCalendarForNewEvents;

// Find out if this calendar is modifiable.
 isDefaultCalModifiable = defaultCal.allowsContentModifications ;


self.event = [ EKEvent eventWithEventStore:eventStore ];

self.event.title = detail1.companyname; 
//self.event.location = @"Pune" ;

//NSDate *today = [NSDate date];

//date=[[NSDate alloc] init];

NSDateFormatter* formatter = [[[NSDateFormatter alloc] init] autorelease];
[formatter setDateFormat:@"dd/MM/yyyy"];
NSString *dateStart1 = detail1.filedate;//[formatter stringFromDate:date];





NSDate *dateStart =[formatter dateFromString:dateStart1] ;

NSDate *dateEnd = [formatter dateFromString:dateStart1];

self.event.startDate = dateStart;
self.event.endDate   = dateEnd; 

self.event.calendar = defaultCal ;  


NSError *error;
saved = [self.eventStore saveEvent:self.event span:EKSpanThisEvent error:&amp;error];
//-------------------------------------------------------   
</code></pre>

<p>but after completing this code the app is terminated or give EXC-BAD ..</p>

<p>So can any one give me solution for that or provide me some solution with sample code.</p>

<p>thanks.
Priyanka....</p>
