EventKit-添加带有2个警报的EKEvent时,应用程序冻结(iOS 5) [英] EventKit - App freezes when adding an EKEvent with 2 alarms (iOS 5)

查看:78
本文介绍了EventKit-添加带有2个警报的EKEvent时,应用程序冻结(iOS 5)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have an app that programmatically adds reminders to your iOS device's calendar.

在iOS 5之前,我可以添加带有两个警报的日历项目:

Previous to iOS 5, I could add a calendar item with two alarms thusly:

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上,此冻结应用程序.它不会返回错误-它只会永不返回.

On iOS 5 this freezes the application. It does not return with an error - it just never returns.

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

If I only call addAlarm once, it works as expected.

在iOS 4.2上,两次调用addAlarm都可以.

On iOS 4.2, calling addAlarm twice works just fine.

我做错什么了吗?

推荐答案

它与Apple有关.如果您设置2条警报,它将导致应用程序冻结.如果您仅设置1,则效果很好.这已在iOS 5.1中修复.

Its a bug with Apple. If you set 2 alarms it causes the app to freeze. If you only set 1 it works just fine. This is fixed in iOS 5.1 .

这篇关于EventKit-添加带有2个警报的EKEvent时,应用程序冻结(iOS 5)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆