Respondiendo a "cancelar" o "Listo" en EKEventEditViewController

Estoy usando un EKEventEditViewController que puedo completar con la información que necesito. Me conceden acceso a los calendars y todo. Mi problema es que cuando hago clic en "Cancelar" no pasa nada. Y cuando hago clic en "Listo" obtengo un error que dice que No se ha establecido ningún calendar, que no se ha establecido ninguna date y que "El evento no pertenece a ese almacén de events".

No creo que se haya llamado a mi método de delegado didCompleteWithAction.

Mi viewController se ajusta a:

@interface EventoViewController : UIViewController <EKEventEditViewDelegate> 

Cuando bash establecer yo como delegado, obtengo el error:

 sending EventoViewController *const__strong' to parameter of incompatible type 'id<UINavigationControllerDelegate>' 

Código original .h

 #import <UIKit/UIKit.h> #import <EventKit/EventKit.h> #import <EventKitUI/EventKitUI.h> @interface EventoViewController : UIViewController <EKEventEditViewDelegate> @property (weak, nonatomic) IBOutlet UILabel *eventDetailTitleLabel; @property (weak, nonatomic) IBOutlet UILabel *eventDetailDateLabel; @property (weak, nonatomic) IBOutlet UILabel *eventDetailDescriptionLabel; - (IBAction)closeModalView:(id)sender; - (IBAction)addEventToNative:(id)sender; @end 

Original .m

 #import "EventoViewController.h" @implementation EventoViewController @synthesize eventDetailTitleLabel, eventDetailDateLabel, eventDetailDescriptionLabel; - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; } - (void)viewDidLoad { [super viewDidLoad]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } - (IBAction)closeModalView:(id)sender { [self dismissModalViewControllerAnimated:YES]; } - (IBAction)addEventToNative:(id)sender { NSLog(@"Clicked "); EKEventStore *eventStore = [[EKEventStore alloc] init]; if([eventStore respondsToSelector:@selector(requestAccessToEntityType:completion:)]) { // iOS 6 and later [eventStore requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error) { // perform the main thread here to avoid any delay. normally seems to be 10 to 15 sec delay. [self performSelectorOnMainThread: @selector(presentEventEditViewControllerWithEventStore:) withObject:eventStore waitUntilDone:NO]; if (granted){ NSLog(@"We are granted to access Calendars!"); //---- codes here when user allow your app to access theirs' calendar. } else { //---- code for no permission NSLog(@"We have no permission to access calendars!"); } }]; } } - (void)presentEventEditViewControllerWithEventStore:(EKEventStore*)eventStore { EKEventEditViewController* eventEditVC = [[EKEventEditViewController alloc] init]; eventEditVC.eventStore = eventStore; EKEvent* event = [EKEvent eventWithEventStore:eventStore]; event.title = self.eventDetailTitleLabel.text; event.startDate = [NSDate date]; event.endDate = [NSDate date]; event.URL = [NSURL URLWithString:@"http://portalsatuat.plataforma.sat.gob.mx/m/sp/paginas/home.aspx"]; event.notes = @"Evento SAT"; event.allDay = YES; eventEditVC.event = event; //eventEditVC.delegate = (id)self; [self presentViewController:eventEditVC animated:YES completion:nil]; } - (void)eventEditViewController:(EKEventEditViewController *)controller didCompleteWithAction:(EKEventEditViewAction)action { NSLog(@"Clicked Cancel or Done"); [self dismissModalViewControllerAnimated:YES]; } - (void)eventViewController:(EKEventViewController *)controller didCompleteWithAction:(EKEventViewAction)action { NSLog(@"No se que esta pasando aqui!"); } - (void)viewDidUnload { [self setEventDetailTitleLabel:nil]; [self setEventDetailDateLabel:nil]; [self setEventDetailDescriptionLabel:nil]; [super viewDidUnload]; } @end 

Debe asignar auto en su class controller de vista a la propiedad editViewDelegate en el controller: la class EKEventEditViewController es una subclass de UINavigationController, por lo que la propiedad de delegado henetworkingada es para manejar events de navigation. Espero que ayude.

 - (void)presentEventEditViewControllerWithEventStore:(EKEventStore*)eventStore { EKEventEditViewController* eventEditVC = [[EKEventEditViewController alloc] init]; eventEditVC.eventStore = eventStore; // Add this line: eventEditVC.editViewDelegate = self;