0
내 startDate 및 endDate를 설정하려고 할 때 계속 오류가 발생합니다. 여기서 내가 뭘 잘못하고 있니? 나는 확실히 누군가가이 오류와 함께 나를 도울 수 있기를 바랍니다iPhone의 이벤트 키트에 이벤트를 저장할 수 없습니다.
EKEventStore *eventStore = [[EKEventStore alloc] init];
EKEvent *newEvent = [EKEvent eventWithEventStore:eventStore];
NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd:HH:mm"];
NSString *fechainicio = @"2011-04-13:22:30";
NSString *fechafin = @"2011-04-14:24:00";
NSDate * date = [[NSDate alloc] init];
date = [dateFormatter dateFromString:fechainicio];
NSDate * date2 = [[NSDate alloc] init];
date2 = [dateFormatter dateFromString:fechafin];
[date2 retain];
[date retain];
[fechainicio retain];
[fechafin retain];
newEvent.title = @"title";
newEvent.startDate = date;
newEvent.endDate = date2;
[newEvent setCalendar:[eventStore defaultCalendarForNewEvents]];
NSError *err;
[eventStore saveEvent:newEvent span:EKSpanThisEvent error:&err];
if (err != nil)
{
NSLog(@"error");
}
그것은 나에게 미친 XD를 운전하는 것 : 여기 내 코드입니다. 감사.
Genius !!! 나는 잘못 포맷 했어, 고마워 !!!! – 0SX
천재가 아닙니다. 그냥 신선한 눈 세트. –