Monday, July 16, 2012

How to add Event in device Calender.


EKEventStore *eventStore = [[EKEventStore allocinit];
        
        EKEvent *event  = [EKEvent eventWithEventStore:eventStore];
        event.title     = @"My Event Name";
     
        event.startDate =[NSDate date];
        event.endDate   = [[NSDate allocinitWithTimeInterval: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