我predicateForEventsWithStartDate:endDate:calendars
用来查找在给定 24 小时内发生的所有事件。我想要在这一天举行的所有活动。我正在努力处理跨越多天的事件——即从晚上 10 点开始,到“第二天”凌晨 2 点结束。
谓词查询在执行搜索时似乎只考虑日历事件的开始日期。它向我显示了在我指定的时间开始(然后结束)的事件,但不显示在该时间段之前开始但随后泄漏到其中的事件。
我可以提前设置开始日期,然后删除在今天开始之前结束的事件。
Apple Docs 并不是特别有见地:
(NSPredicate *)predicateForEventsWithStartDate:(NSDate *)startDate endDate:(NSDate *)endDate calendars:(NSArray *)calendars
startDate: // The start date of the range of events fetched.
endDate: // The end date of the range of events fetched.