【问题标题】:How to fetch device google calendar events in custom iOS App?如何在自定义 iOS 应用程序中获取设备谷歌日历事件?
【发布时间】:2013-08-07 05:04:34
【问题描述】:

我正在开发一个应用程序来获取我的自定义 iOS 应用程序中的设备谷歌日历事件。我已阅读有关如何创建和编辑编辑的事件工具包的文档,但我无法在我的应用程序中获取谷歌日历事件。有没有关于如何从设备获取谷歌日历事件的教程?我需要将谷歌事件 ID 提取到我的应用程序中。有人可以指导如何实现这一目标吗?

【问题讨论】:

标签: ios google-calendar-api eventkit


【解决方案1】:

这个答案可能太迟了。希望这对将来有所帮助。

从本地日历数据库中获取事件,

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

NSPredicate *fetchCalendarEvents = [eventStore predicateForEventsWithStartDate:startDate endDate:endDate calendars:nil];
//Use any specific calendar if you can provide detail. To get calendar detail, use the below code.

NSArray *eventListforDay = [NSArray arrayWithArray:[eventStore eventsMatchingPredicate:fetchCalendarEvents]];

从可用的系统/云日历中选择日历

NSArray *cals = [NSArray arrayWithArray:[eventStore calendarsForEntityType:EKEntityTypeEvent]];

for(EKCalendar *iCal in cals) {
    if (iCal.source.sourceType == EKSourceTypeCalDAV && [iCal.source.title isEqualToString:YOUR_CALENDAR_TITLE]) {
        //save calendar identifier for future use.
        break;
    }
}

【讨论】:

    猜你喜欢
    • 2023-03-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多