ios - 搜索没有日期的 ios 提醒

标签 ios objective-c nspredicate eventkit

我熟悉使用 eventstore 搜索谓词,例如 predicateForIncompleteRemindersWithDueDateStarting:Ending:Calendars:

但我正在尝试找出如何搜索任何未设置任何截止日期的不完整提醒。我试过 NSCompoundPredicateeventstore 不会获取不是使用其自己的谓词创建方法创建的谓词。有什么想法吗?

编辑:根据文档,为开始日期和结束日期传递 nil 会导致所有提醒,而不仅仅是没有到期日期的提醒。

最佳答案

编辑

您可以尝试过滤所有未完成的提醒,以仅获取没有截止日期的提醒:

[store fetchRemindersMatchingPredicate:predicate
                            completion:^(NSArray *reminders)
     {
         NSArray *myReminders = [reminders filteredArrayUsingPredicate:
                                 [NSPredicate predicateWithFormat:@"dueDateComponents = nil"]];
         NSLog(@"%@", myReminders);
     }];

Documentation对于 predicateForIncompleteRemindersWithDueDateStarting:ending:calendars::

Discussion
Pass nil for startDate to find all reminders due before endDate. Similarly, pass nil for both startDate and endDate to get all incomplete reminders in the specified calendars.

关于ios - 搜索没有日期的 ios 提醒,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15572163/

相关文章:

iOS - UITextView 中的新行字符

ios - 在 SKEffectNode 中设置自定义 CIColorCube 过滤器

ios - 在 iOS 上,为什么 100 "points"在不同的设备上大小不同?

swift - 如何在 Core Data 和 NSPredicate 中仅获取一对多关系的子集

core-data - 如何知道 NSPredicate 中抽象实体的类类型?

iphone - NSPredicate 基于此对象是否与另一个对象相关?

c# - Xamarin 如何根据默认设置以编程方式选择uitableview单元格

ios - 无法在 iOS 13 中禁用暗模式 - 基于 plist 权限文本的设备特定权限警报

objective-c - iOS 通过 UIWebView 访问 Safari 阅读器功能

ios - 触摸时 UITextField 崩溃