开发者

Programmatically add reminder to iPhone calendar?

Can anyone have any idea about pro开发者_JAVA百科grammatically add reminder to iPhone calendar.

I searched the iPhone SDK documentation but didn't find anything.

Thanks and Regards Jayaraj


This functionality is available in iOS 4.x with EventKit.


You could try to read this EventKit sample.


Oh yes you can...

    #import <EventKit/EventKit.h>

...

    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 = NO;
    myEvent.notes = @"Test";

    [myEvent setCalendar:[eventDB defaultCalendarForNewEvents]];

    NSError *err;

    [eventDB saveEvent:myEvent span:EKSpanThisEvent error:&err]; 

    if (err == noErr) {
       UIAlertView *alert = [[UIAlertView alloc]
                initWithTitle:@"Event Created"
                message:@"Yay!?"
                delegate:nil
                cancelButtonTitle:@"Okay"
                otherButtonTitles:nil];
       [alert show];
       [alert release];
    }


You can't. If you need this functionality you should file a bug with Apple explaining why you need it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜