gpt4 book ai didi

ios - 无法从 ekstore 查询日历中的提醒

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:20:24 24 4
gpt4 key购买 nike

我正在尝试从日历中获取提醒列表,但总是出现错误。我可以对日历事件做类似的事情,但是当我尝试修改它以进行提醒时,我遇到了问题。
此代码在与 EKEntityMaskReminder 相关的第一行失败

   _store = [[EKEventStore alloc] initWithAccessToEntityTypes:EKEntityMaskReminder];
EKCalendar *calendar = [_store calendarWithIdentifier:[self.detailItem valueForKey:@"cal_id"]];
NSArray *calendarArray = [NSArray arrayWithObject:calendar];
NSPredicate *predicate = [_store predicateForRemindersInCalendars:calendarArray];
_eventsList = [_store fetchRemindersMatchingPredicate:predicate completion:nil];

错误信息是:

-[EKEventStore initWithAccessToEntityTypes:]: unrecognized selector sent to instance 0x157660

如果我这样改变商店:

_store = [[EKEventStore alloc] init];

然后它失败了:

'-[EKEventStore predicateForRemindersInCalendars:]: unrecognized selector sent to instance 0x165c20'

如果我将商店设置为:

_store = [[EKEventStore alloc] init];

它会显示在提醒应用中。

有谁知道为什么我不能查询这些提醒?

最佳答案

从 iOS 6 开始,您遇到错误的两个选择器都可用。如果您尝试针对 beta 操作系统/库以外的其他东西运行您的程序,它将失败。

(非常奇怪的是 initWithAccessToEntityTypes 在 iOS 5.1 文档中被推荐,尽管没有方法描述。)

关于ios - 无法从 ekstore 查询日历中的提醒,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12019069/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com