1

If I develop an app through which we can choose a date and time and enter a text and that text should be added for the corresponding date and time of the native I phone calendar. Is there any way to achieve that?

halfer
  • 19,824
  • 17
  • 99
  • 186
Warrior
  • 39,156
  • 44
  • 139
  • 214
  • possible duplicate of [Programmatically add custom event in the iPhone Calendar](http://stackoverflow.com/questions/246249/programmatically-add-custom-event-in-the-iphone-calendar) – Brad Larson Aug 06 '10 at 22:57

2 Answers2

2

Yes, should be possible using the EventKit framework (introduced in iOS 4.0). EKEvent is the class you're probably looking for.

RupertP
  • 1,329
  • 1
  • 8
  • 7
0

I use this code

EKEventStore *eventStore = [[EKEventStore alloc] init];
if ([eventStore respondsToSelector:@selector(requestAccessToEntityType:completion:)])
{
    // the selector is available, so we must be on iOS 6 or newer
    [eventStore requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error) {
        dispatch_async(dispatch_get_main_queue(), ^{
            if (error)
            {
                // display error message here
            }
            else if (!granted)
            {
                // display access denied error message here
            }
            else
            {
                // access granted
                // ***** do the important stuff here *****
            }
        });
    }];
}
else
{
    // this code runs in iOS 4 or iOS 5
    // ***** do the important stuff here *****
}
Mina Fawzy
  • 20,852
  • 17
  • 133
  • 156