Ios EKEventStore搜索事件,标题为NSPredicate

Ios EKEventStore搜索事件,标题为NSPredicate,ios,objective-c,calendar,nspredicate,Ios,Objective C,Calendar,Nspredicate,我需要搜索添加到iOS日历中的带有标题或注释的事件。我喜欢使用[NSPredicate predicateWithFormat:@“类似于“回调”的标题]搜索事件 谷歌搜索时,我只得到了PreventSwithStartDate谓词。我们如何在iOS中获取/搜索带有标题或注释的事件。要做到这一点,需要两个谓词 这里有一个例子: // you init your store event EKEventStore *store = [[EKEventStore alloc] init]; //yo

我需要搜索添加到iOS日历中的带有标题或注释的事件。我喜欢使用
[NSPredicate predicateWithFormat:@“类似于“回调”的标题]
搜索事件


谷歌搜索时,我只得到了PreventSwithStartDate谓词。我们如何在iOS中获取/搜索带有标题或注释的事件。

要做到这一点,需要两个谓词

这里有一个例子:

// you init your store event
EKEventStore *store = [[EKEventStore alloc] init];

//you get the list of events
NSPredicate *datePredicate = [store predicateForEventsWithStartDate:[[NSDate date] dateByAddingTimeInterval: -86400.0] //yesterday
                                                            endDate:[NSDate date] //today
                                                          calendars:nil];
//this will return a list of EKEvent
NSArray<EKEvent *> *events = [store eventsMatchingPredicate:datePredicate];

//you create a second predicate to test on title or wethever you want
NSPredicate *textPredicate = [NSPredicate predicateWithFormat:@"title like 'Callback'"];

//here you will get the events with title like Callback
NSArray<EKEvent *> *results = [events filteredArrayUsingPredicate:textPredicate];
//您初始化了存储事件
EKEventStore*store=[[EKEventStore alloc]init];
//你可以得到事件列表
NSPredicate*datePredicate=[store predicateForEventsWithStartDate:[[NSDate date]dateByAddingTimeInterval:-86400.0]//昨天
endDate:[NSDate日期]//今天
日历:无];
//这将返回事件列表
NSArray*事件=[store eventsMatchingPredicate:datePredicate];
//您可以创建第二个谓词来测试标题或您想要的内容
NSPredicate*textPredicate=[NSPredicate predicateWithFormat:@“类似于“回调”的标题];
//在这里,您将获得标题为Callback的事件
NSArray*results=[events filteredArrayUsingPredicate:textPredicate];

因此没有其他选项:-(