I am pulling my hair out trying to learn the basics of EventKit reminders. I am trying to recreate the tutorial here: http://www.techotopia.com/index.php/Using_iOS_6_Event_Kit_to_Create_Date_and_Location_Based_Reminders
But when I try to build the project I get errors in my .m file of "missing context for method declaration" both at the IBAction and at the CreateReminder. I tried to look here for advice but still can't seem to figure out what I am doing wrong. Have to say what are the use of these tutorials if they are all the time leaving out some basic information that prevents it from building. If anyone can help, I would greatly appreciate it.
#import <UIKit/UIKit.h>
#import <EventKit/EventKit.h>
@interface ReminderAppFirstViewController : UIViewController
@property (strong, nonatomic) EKEventStore *eventStore;
@property (strong, nonatomic) IBOutlet UIDatePicker *myDatePicker;
@property (strong, nonatomic) IBOutlet UITextField *reminderText;
- (IBAction)setReminder:(id)sender;
- (void)createReminder;
@end
- (IBAction)setReminder:(id)sender {
if (_eventStore == nil)
{
_eventStore = [[EKEventStore alloc]init];
[_eventStore requestAccessToEntityType:EKEntityTypeReminder comnpletion: ^(BOOL granted, NSError *error) ] {
if (!granted)
NSLog(@"Access to store not granted");
}];
}
if (_eventStore != nil)
[self createReminder];
}
- (void)createReminder
{
EKReminder *reminder = [EKReminder
reminderWithEventStore:self.eventStore];
reminder.title = _reminderText.text;
reminder.calendar = [_eventStore defaultCalendarForNewReminders];
NSDate *date = [_myDatePicker date];
EKAlarm *alarm = [EKAlarm alarmWithAbsoluteDate:date];
[reminder addAlarm:alarm];
NSError *error = nil;
[_eventStore saveReminder:reminder commit:YES error:&error];
if (error)
NSLog(@"error = %@", error);
}