0

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.

Cœur
  • 37,241
  • 25
  • 195
  • 267
JDev
  • 5,168
  • 6
  • 40
  • 61
  • so basically you want to execute your method when a button on an action sheet is tapped ? is this your problem ? – ahmad Mar 17 '13 at 12:35
  • Well I was also looking for some possible verification with my code, but yes I was wondering what code I would need to execute the `Write Reminder` event. – JDev Mar 17 '13 at 13:40

1 Answers1

1

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.

Abhishek Singh
  • 6,068
  • 1
  • 23
  • 25
  • My apologies! I wish to add a reminder and set the default time to 6 hours from whenever the reminder was clicked. I also wish the set the reminder title and description to that of my NSString values `webTitle` and `urlField`. My apologies for being unclear. :) – JDev Mar 17 '13 at 13:35
  • you just have to remove your function and add the code to the viewDidLoad . also you can change the name of the function and a return type is not needed.And for 6 hrs , it should be 6*60*60 in intiWithTineInterval – Abhishek Singh Mar 18 '13 at 09:56