2

您好,我在 iCloud 上的特定日历中保存了一些 EKEvent,我想检索其中一些具有特定标题的 EKEvent,这可能吗?我看到有这种方法:

eventsMatchingPredicate

但只有一个谓词:

predicateForEventsWithStartDate:endDate:calendars:

我想找到 EKEvent 作为标题,有什么想法吗?

4

1 回答 1

3

我建议您存储事件的 ID,然后使用EKEventStore方法获取它- (EKEvent *)eventWithIdentifier:(NSString *)identifier

编辑:啊哈,现在我明白你的问题了。不幸的是,您可以与 EKEventStore 一起使用的唯一谓词是- (NSPredicate *)predicateForEventsWithStartDate:(NSDate *)startDate endDate:(NSDate *)endDate calendars:(NSArray *)calendars

因此,您必须提供开始日期和结束日期才能获取这些日期之间的事件。获取事件后,您可以使用 NSArray 过滤事件,- filteredArrayUsingPredicate:这样您就可以给它一个带有事件标题的谓词。

于 2012-12-09T23:41:21.810 回答