I have been learning Xcode 4.2 for a bit now and still can't get my head round on how the create a calendar so i really hope you guys can help me sort out my errors and maybe tell me what the next step in the code is to get this working i really appreciate your time thanks.
This is the storyboard
.h there are no errors here
#import <UIKit/UIKit.h>
#import <EventKitUI/EventKitUI.h>
@interface FirstViewController : UIViewController <EKEventEditViewDelegate> {
}
-(IBAction) createEvent;
@end
.m this is where the errors are
#import "FirstViewController.h"
#import <EventKitUI/EventKitUI.h>
@implementation FirstViewController
-(IBAction) createEvent {
//Get the event store object
EKEventStore *eventStore = [[EKEventEditViewController alloc] INIT];
//Cretae the EditViewController
EKEventEditViewController* controller = [[EKEventEditViewController alloc] INIT];
controller.eventStore = eventStore;
controller.editViewDelegate = self;
[self presentModalViewController:controler animated:YES];
[controller release];
}
//delegate method for EKEventEditViewDelegate
-(void)eventEditViewController:(EKEventEditViewController *)controller
didCompleteWithAction:(EKEventEditViewAction)action {
[self dismissModalViewControllerAnimated:YES];
}
Errors:
EKEventStore *eventStore = [[EKEventEditViewController alloc] INIT];
Receiver type 'EKEventEditViewController' for instance message does not declare a method with selector 'init'
EKEventEditViewController* controller = [[EKEventEditViewController alloc] INIT];
Receiver type 'EKEventEditViewController' for instance message does not declare a method with selector 'init'
[controller release];
'release' is unavailable: not available in automatic reference counting mode 2
That's all the errors hope you guys can tall me whats wrong i really appreciate it :)
It's init
, not INIT
.
You need to get rid of the [controller release];
if you're using ARC.
So, change to this:
-(IBAction) createEvent {
//Get the event store object
EKEventStore *eventStore = [[EKEventStore alloc] init];
//Cretae the EditViewController
EKEventEditViewController* controller = [[EKEventEditViewController alloc] init];
controller.eventStore = eventStore;
controller.editViewDelegate = self;
[self presentModalViewController:controler animated:YES];
}