버튼을 통해 약속을 알리는 응용 프로그램이 있습니다. 환자가 버튼을 클릭하면 환자 캘린더의 모든 이벤트를 가져 와서 약속이 이미 있는지 확인하고 싶습니다. 존재하지 않으면, 나는 사건을 창조 할 것이다.iPhone 캘린더에서 모든 일정 가져 오기 시작 날짜가
캘린더에 이벤트를 추가하는 방법을 알고 있지만 페칭은 0을 반환합니다. ??
//set start and end date
NSDate* startDate = [NSDate date];//start from today
NSDate* endDate = [NSDate dateWithTimeIntervalSinceNow:[[NSDate distantFuture] timeIntervalSinceReferenceDate]];//no end
NSLog(@"S Date %@", startDate);
NSLog(@"E Date %@", endDate);
NSString *[email protected]"Appointment in Hospital at Pediatric Clinic";
EKEventStore *store = [[EKEventStore alloc] init];
NSArray *calendarArray = [store calendars];
NSPredicate *fetchCalendarEvents = [store predicateForEventsWithStartDate:startDate endDate:endDate calendars:calendarArray];
NSArray *eventList = [store eventsMatchingPredicate:fetchCalendarEvents];
BOOL IsFound;
int EventsCount=eventList.count;
for(int i=0; i < EventsCount; i++)
{
NSLog(@"Event Title:%@", [[eventList objectAtIndex:i] title]);
if ([[[eventList objectAtIndex:i] title] isEqualToString:AppointmentTitle])//check title
{
IsFound=TRUE;
break;
}
else
{
IsFound=FALSE;
}
}
이 코드 2 개월 전 잘 작동되었습니다
다음은 내 코드입니다. 갑자기, 내가 그것을 테스트하기 위해 되돌아 왔을 때, 그것은 효과가 없었습니다. 내가 뭐 놓친 거 없니? 또는 내 코드에 실수가 있습니까?
내가 PLZ 당신의 도움이 필요합니다 .. Finaaaaaaaally
답변 없음 pleeeeease? –