Monday, July 2, 2012

How to add Event in device Calender.


        EKEventStore *eventStore = [[EKEventStore alloc] init];
        
        EKEvent *event  = [EKEvent eventWithEventStore:eventStore];
        event.title     = @"My Event Name";
     
        event.startDate =[NSDate date];
        event.endDate   = [[NSDate alloc] initWithTimeInterval:60 sinceDate:event.startDate];
       
        [event setCalendar:[eventStore defaultCalendarForNewEvents]];
        NSError *err;
        [eventStore saveEvent:event span:EKSpanThisEvent error:&err];  



And don't forget to add #import  to your file and EventKit framework to your project.

No comments:

Post a Comment