I'm having problems when creating a calendar event in my app, i have a collection view that have dates when you click one of them the view controller pops out without the name or date that i passed by code.
Here's the code:
EKEventStore *eventStore = [[EKEventStore alloc] init];
if([eventStore respondsToSelector:@selector(requestAccessToEntityType:completion:)]) {
//This code will run when uses has made his/her choice
EKEvent *event = [EKEvent eventWithEventStore:eventStore];
[event setTitle:theTitle];
event.startDate = date;
event.endDate = date;
EKEventEditViewController *controller = [[EKEventEditViewController alloc] init];
controller.navigationBar.backgroundColor = [UIColor blackColor];
[event setCalendar:[eventStore defaultCalendarForNewEvents]];
NSError *err;
[eventStore saveEvent:event span:EKSpanThisEvent error:&err];
NSLog(@"err %@", err);
controller.eventStore = eventStore;
controller.editViewDelegate = self;
[self presentViewController:controller animated:YES completion:nil];
}
The code is in the
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
Does EKEventStore
have special methods to set the date or title?