EKRecurrenceRule未与EKEvent一起保存

时间:2017-09-22 20:33:45

标签: objective-c

我有一个应用程序正在运行,直到iOS11才能正常运行。在许多其他方面,它设置重复的EKEvents。这些事件仍按预期复制到日历中,但不会再次发生。保存事件后,复发消失了。

多数民众赞成我是怎么做的:

       EKEventStore *newStore = [[EKEventStore alloc] init];

        // define new EKEvent
        EKEvent *newEvent = [EKEvent eventWithEventStore:newStore];
        newEvent.calendar = [ResourceManager sharedResourceManager].selectedCalendar;
        newEvent.allDay = TRUE;
        newEvent.startDate = loopNSDate;
        newEvent.endDate = loopNSDate;
        newEvent.availability = EKEventAvailabilityFree;            

        EKRecurrenceRule *rule = [[EKRecurrenceRule alloc]
                                  initRecurrenceWithFrequency:EKRecurrenceFrequencyDaily
                                  interval:diensteInPlan
                                  end:end];

        NSArray *recurrenceRulesForDate = @[rule];

        newEvent.recurrenceRules = recurrenceRulesForDate;

        newEvent.title = @"EventTitle";
        newEvent.notes = note;

        NSError *error = nil;

        [newStore saveEvent:newEvent span:EKSpanThisEvent  error:&error];

在“saveEvent ...”之前NSLOGging newEvent显示具有正确重复的事件。但之后的NSLogging显示了相同的事件 - 但是(nill)为重复。

我在这里遗漏了什么吗?非常感谢提前。

0 个答案:

没有答案