許可がない場合、どうすればエラーを表示できますか?(例:「あなたは私たちにあなたのカレンダーに書く許可を与えません。」)。
これは私のコードです:
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"6.0")) {
EKEventStore *es = [[EKEventStore alloc] init];
[es requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error) {
/* This code will run when uses has made his/her choice */
}];
}
NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"ddMMyy"];
NSString *fechainicio = datum;
NSString *fechafin = datum;
titel = [NSString stringWithFormat:@"%@ (%@)", titel, plaatslabel.text];
NSDate * date = [[NSDate alloc] init];
date = [dateFormatter dateFromString:fechainicio];
NSDate * date2 = [[NSDate alloc] init];
date2 = [dateFormatter dateFromString:fechafin];
EKEventStore *eventStore = [[EKEventStore alloc] init];
EKEvent *event = [EKEvent eventWithEventStore:eventStore];
event.title = @"Optreden Ronald Goedemondt";
event.location = titel;
event.allDay = YES;
event.startDate = date;
event.endDate = date2;
[event setCalendar:[eventStore defaultCalendarForNewEvents]];
NSError *err;
[eventStore saveEvent:event span:EKSpanThisEvent error:&err];
WBSuccessNoticeView *notice = [WBSuccessNoticeView successNoticeInView:self.view title:@"Show geplaatst in uw agenda."];
[notice show];