title: Add Event to calendar in xcode iOS
body: <p>Hy</p>
  
  <p>I have this code for adding Events to calendar but it does not add.</p>
  
  <pre><code>-(void)event
  {
      EKEventStore *eventStore = [[EKEventStore alloc] init];
  
      EKEvent *event  = [EKEvent eventWithEventStore:eventStore];
      event.title     = @"Event";
  
  
      NSDateFormatter *tempFormatter = [[NSDateFormatter alloc]init];
      [tempFormatter setDateFormat:@"dd.MM.yyyy HH:mm"];
  
  
      NSString *dateandtime =[NSString stringWithFormat:@"%@%@%@",datestring,@" ",starttimestring];
      NSString *dateandtimeend =[NSString stringWithFormat:@"%@%@%@",datestring,@" ",endtimestring];
  
  
  
      event.startDate = [tempFormatter dateFromString:dateandtime];
      event.endDate = [tempFormatter dateFromString:dateandtimeend];
  
  
      [event addAlarm:[EKAlarm alarmWithRelativeOffset:60.0f * -60.0f * 24]];
      [event addAlarm:[EKAlarm alarmWithRelativeOffset:60.0f * -15.0f]];
  
      [event setCalendar:[eventStore defaultCalendarForNewEvents]];
      NSError *err;
      [eventStore saveEvent:event span:EKSpanThisEvent error:&amp;err];
  }
  </code></pre>
  
  <p>From the XML I get the date and time in this format:</p>
  
  <p>datestring: 28.10.2012 </p>
  
  <p>starttimestring: 15:00</p>