Note that there are some explanatory texts on larger screens.

plurals
  1. POXcode: Event not created in Calendar : issue With Timezone?
    primarykey
    data
    text
    <p>ddI am facing issue while creating Event in Native CALENDAR, When i pass <strong>event.startDate</strong> anything other than present timestamp... also <strong>event.endDate</strong> not working with different value as below..</p> <pre><code>- (void)createEventInCalendar:(NSString *)calendarType withTitle:(NSString *)eventTitle startDate:(NSString *)stDate endDate:(NSString *)endDATE withNotes:(NSString *)paramNotes addAlarm:(BOOL)alarmNeeded { EKEventStore *eventStore = [[EKEventStore alloc] init]; /* Are there any calendars available to the event store? */ if ([eventStore.calendars count] == 0){ NSLog(@"No calendars are found."); } EKEvent *event = [EKEvent eventWithEventStore:eventStore]; event.title = [NSString stringWithFormat:@"%@ with Alarm", eventTitle]; //Convert String to DATE NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; [dateFormat setDateFormat:@"yyyy-MM-dd HH:mm:SS"]; NSDate* date1 = [dateFormat dateFromString:stDate]; NSDate* date2 = [dateFormat dateFromString:endDATE]; //get Difference betwenn 2 DATE Values NSTimeInterval distanceBetweenDates = [date1 timeIntervalSinceDate:date2]; event.startDate = date1; event.endDate = [date1 initWithTimeInterval:distanceBetweenDates sinceDate:event.startDate]; event.notes = paramNotes; /* The alarm goes off 2 seconds before the event happens */ EKAlarm *alarm = [EKAlarm alarmWithRelativeOffset:-2.0f]; [event addAlarm:alarm]; [event setCalendar:[eventStore defaultCalendarForNewEvents]]; NSError *err; [eventStore saveEvent:event span:EKSpanThisEvent error:&amp;err]; NSLog(@"Error shows: %@", err); //Show EVENT EDIT Screen to User. EKEventEditViewController *controller = [[EKEventEditViewController alloc] init]; controller.eventStore = eventStore; controller.event = event; controller.editViewDelegate = self; [self presentModalViewController:controller animated:YES]; } </code></pre> <h3>After debug: Error Domain=EKErrorDomain Code=4 "The start date must be before the end date." UserInfo=0x223170 {NSLocalizedDescription=The start date must be before the end date.}</h3> <p>where as my Log: ST DATE: 2013-04-25 07:50:00 &amp; end DATE: 2013-04-29 07:50:00</p> <p>but EVENT EDIT View shows END DATE value sometime before START DATE.. Its strange. </p> <p>Can anyone guide me as to how to solve it ? Thanks.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload