2015-10-17 61 views
1

我正在构建一个内置了一些iOS日历功能的应用程序。用户可以创建事件并将它们发送到他们的iCal,但我只希望在我的应用程序中创建的事件显示在应用程序的日历中。iOS EventKit Additional Predicates

我知道我可以使用谓词象下面这样:

NSPredicate *predicate = [_eventStore predicateForEventsWithStartDate:startDate endDate:endDate calendars:preferredAppleCalendars]; 
NSArray *appleEventsArray = [_eventStore eventsMatchingPredicate:predicate]; 

但我也有,我想补充一个条件eventIdentifiers的数组。所以,我想从上面的事件存储事件,但只有当事件匹配我的数组中的事件标识符。那可能吗?

回答

2

而不是实际将所有事件提取到与eventsMatchingPredicate阵列中,请致电enumerateEventsMatchingPredicate。这可以让你进一步过滤结果,只保留你喜欢的。记得先到后台线程!

+0

完美,这导致我学习更多关于enumerateEventsMatchingPredicate,这正是我需要的。 –