Question

The objective is to create a reminder event via Apple's documentation. So far I have the instance variable created (and implemented in the header file as well).

- (EKReminder *)reminderWithEventStore:(EKEventStore *)eventStore {

    EKEvent *event  = [EKEvent eventWithEventStore:eventStore];
    event.title     = webTitle;
    event.notes     = urlField.text;

    event.startDate = [[NSDate alloc] init];
    event.endDate   = [[NSDate alloc] initWithTimeInterval:600 sinceDate:event.startDate];

    [event setCalendar:[eventStore defaultCalendarForNewEvents]];
    NSError *err;
    [eventStore saveEvent:event span:EKSpanThisEvent error:&err];
}

How do I create the reminder by executing the code upon clicking a button within a UIActionSheet? I've tried [self.eventStore:self]; but I'm guessing theres more to it than just that.

Was it helpful?

Solution

Here You are just adding an event to the default Calendar . The event is added , once you call this function.

Simply Create an Object of EKEventStore

EKEventStore *eventStore = [[EKEventStore alloc] init];

and call your function :-

[self reminderWithEventStore:eventStore];

But you are not returning anything in your non-void function :) , but , the function definition is already documented in iOS API version 6 for EKReminder Apple, which is a class Method.

+ (EKReminder *)reminderWithEventStore:(EKEventStore *)eventStore

are you trying to override the above method.

You can simply add a reminder in the calendar using above class method.

First you should be clear of your motive , whether you want to add

1 Event

2 Reminder

3 Calendar.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top