gpt4 book ai didi

ios - EventKit,保存事件时出错 : The repeat field cannot be changed.

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

我正在构建一个日历应用程序,在尝试保存某些事件时偶尔会遇到一个奇怪的错误。我还不能可靠地产生一个事件来复制这个问题,但我很幸运(如果你可以这么说的话)再次遇到这个错误。

问题是当我保存某些事件时,它们拒绝保存它们的重复规则。大多数事件都保存得很好,从来没有问题。

我在下面包含了我的调试输出。第一部分 EVENT 描述了打开编辑时的事件对象。第二部分,EVENT TO BE SAVED,描述了即将被保存之前的事件对象。最后一部分,EVENT SAVING ERROR,描述了 EKEventStore saveEvent:span:commit:error: 方法设置的错误。

如有任何帮助,我们将不胜感激。

2013-12-23 11:47:23.641 planner[4360:60b] EVENT: EKEvent <0x1554d5d0>
{
EKEvent <0x1554d5d0>
{ title = Test repeat m;
location = ;
calendar = EKCalendar <0x1564cfc0> {title = Calendar; type = Local; allowsModify = YES; color = #CC73E1;};
alarms = (null);
URL = (null);
lastModified = 2013-12-23 17:31:29 +0000;
timeZone = America/Chicago (CST) offset -21600
};
location = ;
startDate = 2013-12-23 07:00:00 +0000;
endDate = 2013-12-23 08:00:00 +0000;
allDay = 0;
floating = 0;
recurrence = (null);
attendees = (null)
};

2013-12-23 11:47:32.480 planner[4360:60b] EVENT TO BE SAVED: EKEvent <0x1554d5d0>
{
EKEvent <0x1554d5d0>
{ title = Test repeat m;
location = ;
calendar = EKCalendar <0x1564cfc0> {title = Calendar; type = Local; allowsModify = YES; color = #CC73E1;};
alarms = (null);
URL = (null);
lastModified = 2013-12-23 17:31:29 +0000;
timeZone = America/Chicago (CST) offset -21600
};
location = ;
startDate = 2013-12-23 07:00:00 +0000;
endDate = 2013-12-23 08:00:00 +0000;
allDay = 0;
floating = 0;
recurrence = EKRecurrenceRule <0x155a3d10> RRULE FREQ=DAILY;INTERVAL=1;
attendees = (null)
};

2013-12-23 11:47:32.492 planner[4360:60b] EVENT SAVING ERROR: Error Domain=EKErrorDomain Code=28 "The repeat field cannot be changed." UserInfo=0x155826a0 {NSLocalizedDescription=The repeat field cannot be changed.}

最佳答案

啊哈!我终于想通了!如果重复事件与范围 EKSpanThisEvent 一起保存,它将变为“分离的”。这可以通过调用 [event isDetached] 来检查。我们不允许保存分离事件的重复规则。

我在我的应用程序中使用的解决方案是在用户编辑分离事件时隐藏用于设置重复规则的控件。这似乎与 Apple 在默认日历应用程序中使用的解决方案相同。

关于ios - EventKit,保存事件时出错 : The repeat field cannot be changed.,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20748869/

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