gpt4 book ai didi

iphone - EventKit - 添加带有 2 个警报的 EKEvent 时应用程序卡住 (iOS 5)

转载 作者:可可西里 更新时间:2023-11-01 04:54:44 26 4
gpt4 key购买 nike

我有一个应用程序可以通过编程方式将提醒添加到您的 iOS 设备的日历中。

在 iOS 5 之前,我可以这样添加一个带有两个闹钟的日历项:

EKEventStore* eventStore = [[EKEventStore alloc] init];
EKEvent* event = [EKEvent eventWithEventStore:eventStore];
// set startDate, endDate, title, location, etc.

[event addAlarm:[EKAlarm alarmWithRelativeOffset:60.0f * -5.0f]]; // 5 min
[event addAlarm:[EKAlarm alarmWithRelativeOffset:60.0f * -15.0f]]; // 15 min

[event setCalendar:[eventStore defaultCalendarForNewEvents]];
NSError* error = nil;
BOOL success = [eventStore saveEvent:event span:EKSpanThisEvent error:&error];

在 iOS 5 上,这会卡住应用程序。它不会返回错误 - 它永远不会返回。

如果我只调用一次 addAlarm,它会按预期工作。

在 iOS 4.2 上,调用 addAlarm 两次就可以了。

我做错了什么吗?

最佳答案

这是 Apple 的一个错误。如果您设置 2 个闹钟,它会导致应用程序卡住。如果你只设置 1 它工作得很好。这在 iOS 5.1 中已修复。

关于iphone - EventKit - 添加带有 2 个警报的 EKEvent 时应用程序卡住 (iOS 5),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7844402/

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