ボタンを介して患者に予約を思い出させるアプリケーションがあります。患者がボタンをクリックした場合、患者カレンダーのすべてのイベントを取得して、予約が既に存在するかどうかを確認します。存在しない場合は、イベントを作成します。
イベントをカレンダーに追加する方法は知っていますが、フェッチはゼロカウントを返しますか??
以下は私のコードです:
//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 *AppointmentTitle=@"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..