objective-c - 使用 EventKit 将新日历添加到 EKEventStore

标签 objective-c ios cocoa-touch eventkit

<分区>

如何在 iOS 5 中将日历(不是事件)添加到 EKEventStore?

最佳答案

我捕获了一个异常,除非我也捕获了:

// Get the calendar source
EKSource* localSource;
for (EKSource* source in eventStore.sources) {
    if (source.sourceType == EKSourceTypeLocal)
    {
        localSource = source;
        break;
    }
}

if (!localSource)
    return;

calendar = [EKCalendar calendarWithEventStore:eventStore];
calendar.source = localSource;

自然地,看看其他 EKSourceType 枚举,看看哪个适合您的需要。

关于objective-c - 使用 EventKit 将新日历添加到 EKEventStore,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7945537/

相关文章:

ios - 使用不同的说明符值代替空值

ios - swift 3 : Using Two Arrays to populate grouped Table

ios - 对象似乎被释放,但内存占用不断增加

cocoa-touch - 显示键盘时缩小所有 View

objective-c - iPhone SDK中日期的NSTimeinterval问题

iphone - 内存泄漏问题

objective-c - FBNativeDialog 不支持 Facebook sdk 3.1

ios - 在 Swift iOS 中将 float 转换为字符串

iphone - 向 UIDatePicker 添加值

ios - 在 UITableViewCell 中设置边框并在滚动时闪烁的问题