1

我正在尝试创建一个calendar显示在Apple's calendar(来自我的应用程序)中的内容,但我希望它是只读的(只能从我的应用程序中编辑,不能双向同步到Apple's calendar系统)——我希望 usingEKSourceTypeSubscribed可以解决这个问题,并使用了以下代码:

    EKSource *theSource = nil;
    for (EKSource *source in store.sources) {
        if (source.sourceType == EKSourceTypeSubscribed) {
            theSource = source;
            break;
        }
    }

尝试检索相关的EKSource(因为似乎没有办法创建新的源。但是,除非用户已经订阅了一些日历,否则似乎这种源类型不存在。

有任何想法吗?

4

1 回答 1

0

没有 EventKit 日历的概念,您可以修改其事件,但不能从本机日历应用程序(或任何 3rd 方日历管理应用程序,就此而言)进行修改。

使用创建的仅供参考的日历EKSourceTypeSubscribed不是只读的,即使您可以可靠地找到源类型。

EKCalendar *theCal = [EKCalendar calendarForEntityType:EKEntityTypeEvent eventStore:self.eventStore];
theCal.source = theSource; // per your source selection snippet above
NSLog(@"isImmutable %d, allowsContentModifications %d", [theCal isImmutable], [theCal allowsContentModifications]);

结果是

isImmutable 0, allowsContentModifications 1
于 2014-05-07T18:28:36.740 回答