I am working with EventKit framework in iOS 5 and I successfully added an event to the iOS calendar using the below code
EKEventStore *eventDB = [[EKEventStore alloc] init];
EKEvent *myEvent = [EKEvent eventWithEventStore:eventDB];
myEvent.title = @"New Event";
myEvent.startDate = [[NSDate alloc] init];
myEvent.endDate = [[NSDate alloc] init];
myEvent.allDay = YES;
[myEvent setCalendar:[eventDB defaultCalendarForNewEvents]];
Now How shall i added an alarm (reminder) for this event ?
Thanks Ranjit
By Adding this code -
NSTimeInterval interval = 60* -min;
Where min is the time when you want to show alert. this should be a negative value so that this will appear (min) before of your event.
EKAlarm *alarm = [EKAlarm alarmWithRelativeOffset:interval];
[myEvent addAlarm:alarm];
Enjoy!!!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With