title: Manage iPhone Calendar event from our application
body: <p>The following is my code </p>
  
  <pre><code>NSLog(@"%@", thisEvent1.title); 
  
  EKEvent *thisEvent  = [EKEvent eventWithEventStore:eventStore];
  
  eventStore = [[EKEventStore alloc] init];
  
  thisEvent = [EKEvent eventWithEventStore:eventStore];
  
  
  NSDateFormatter *   dateFormatter = [[NSDateFormatter alloc] init];
  [dateFormatter setDateFormat:@"yyyy-MM-dd:HH:mm"];
  
  
  NSDate * date = [[NSDate alloc] init];
  date = [dateFormatter dateFromString:[itsStartDate objectAtIndex:indexPath.row]];
  [date retain];
  
  thisEvent.startDate = [dateFormatter dateFromString:[itsStartDate objectAtIndex:indexPath.row]];
  thisEvent.endDate = [dateFormatter dateFromString:[itsEndDate objectAtIndex:indexPath.row]];
  thisEvent.notes = [itsNotes objectAtIndex:indexPath.row];
  thisEvent.title = [itsTitle objectAtIndex:indexPath.row];
  thisEvent.location = [itsLocation objectAtIndex:indexPath.row];
  // thisEvent.allDay = TRUE;
  NSMutableArray *myAlarmsArray = [[NSMutableArray alloc] init];
  
  EKAlarm *alarm1 = [EKAlarm alarmWithRelativeOffset:-[[itsAlertOne objectAtIndex:indexPath.row] intValue]]; // 1 Hour
  // EKAlarm *alarm2 = [EKAlarm alarmWithRelativeOffset:-86400]; // 1 Day
  
  [myAlarmsArray addObject:alarm1];
  //[myAlarmsArray addObject:alarm2];
  
  thisEvent.alarms = myAlarmsArray;
  [myAlarmsArray release];
  
  //setting the Reuccurence rule
  
  NSString * test1 = [itsRecurrenceFrequency objectAtIndex:indexPath.row];
  
      BOOL isRecurrenceFrequencyExists = TRUE;
  
  EKRecurrenceFrequency  recurrenceFrequency;
  
  if ([test1 isEqualToString: @"EKRecurrenceFrequencyDaily"]) {
      recurrenceFrequency = EKRecurrenceFrequencyDaily;
  }else if([test1 isEqualToString: @"EKRecurrenceFrequencyWeekly"]){
      recurrenceFrequency = EKRecurrenceFrequencyWeekly;
  }else if([test1 isEqualToString: @"EKRecurrenceFrequencyMonthly"]){
      recurrenceFrequency = EKRecurrenceFrequencyMonthly;
  }else if([test1 isEqualToString: @"EKRecurrenceFrequencyYearly"]){
      recurrenceFrequency = EKRecurrenceFrequencyYearly;
  }else{
      isRecurrenceFrequencyExists = FALSE;
  }
  
      if(isRecurrenceFrequencyExists){
          EKRecurrenceRule * recurrenceRule = [[EKRecurrenceRule alloc] 
  
                                       initRecurrenceWithFrequency:recurrenceFrequency
                                       interval:[[itsRecurrenceInterval objectAtIndex:indexPath.row]intValue]
                                       end:nil];
          if (thisEvent.endDate != nil) {
              EKRecurrenceEnd * end = [EKRecurrenceEnd recurrenceEndWithEndDate:thisEvent.endDate];
              recurrenceRule.recurrenceEnd = end;
          }else {
              thisEvent.endDate = thisEvent.startDate;
          }
  
          thisEvent.recurrenceRule = recurrenceRule;
          [recurrenceRule release];
  
      }
  [thisEvent setCalendar:[eventStore defaultCalendarForNewEvents]];
  NSError *err;
  
  
  [eventStore saveEvent:thisEvent span:EKSpanFutureEvents error:&amp;err]; 
  NSLog(@"%@", thisEvent.eventIdentifier);
  [self.eventsList addObject:thisEvent];
  </code></pre>
  
  <p>In this code I have the Event id of my calendar event.  </p>
  
  <ol>
  <li><p>Now I want to update the event with the changes however Its not updating the previously created event. </p></li>
  <li><p>Second I Need to know is it possible to capture the changes in calendar event they made in iPhone Calendar including deleting an event.</p></li>
  <li><p>Can we delete the calendar event using the eventid?</p></li>
  </ol>
  
  <p>Please help me if any one know the answer..  Thank you in advance.</p>
  
  <p>Regards,
  Dilip Rajkumar</p>