[英]Synchronization with google calendar
I want to synchronise all events with Google Calendar. 我想将所有事件与Google日历同步。 I used the following code to do this:
我使用以下代码执行此操作:
EKEventStore *eventStore = [[[EKEventStore alloc] init] autorelease];
calendarsArray = [[NSArray alloc] init];
calendarsArray = [[eventStore calendars] retain];
EKCalendar *calendar = [calendarsArray objectAtIndex:1];
[events setCalendar:calendar];
NSError *err;
[eventStore saveEvent:events span:EKSpanThisEvent error:&err];
But I am not getting google calendar at object at index(1).
Please note that calendars is deprecated in iOS 6 use this instead: 请注意,iOS 6中不建议使用日历,请改用以下方法:
(NSArray *)calendarsForEntityType:(EKEntityType)entityType
Entity type then needs to be one of these: 然后,实体类型必须是以下类型之一:
typedef enum {
EKEntityTypeEvent,
EKEntityTypeReminder
} EKEntityType;
This should give you the expected result, more info: https://developer.apple.com/library/ios/documentation/EventKit/Reference/EKEventStoreClassRef/Reference/Reference.html#//apple_ref/occ/instm/EKEventStore/calendarsForEntityType : 这应该给您预期的结果,更多信息: https : //developer.apple.com/library/ios/documentation/EventKit/Reference/EKEventStoreClassRef/Reference/Reference.html#//apple_ref/occ/instm/EKEventStore/calendarsForEntityType :
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.