如何从iphone应用程序向Google日历添加活动?

时间:2012-01-19 07:25:11

标签: iphone ios events google-calendar-api icalendar

我以编程方式从iPhone应用程序add and delete events iCal了解到Google Calendar。但是,我需要在我的应用程序中显示从iPhone到用户的所有其他同步日历。我想将用户的事件添加到Yahoo calendar或其他已同步的日历(如{{1}})而不是iCal。我尽我所能在Google中找到解决方案。但我无法找到任何有效的解决方案。我希望在Stackoverflow上。能否请您提出任何有关教程,示例代码或想法的建议。请帮我。提前致谢。

2 个答案:

答案 0 :(得分:0)

谢谢大家。我已经解决了我上面提到的问题。我在EKEventStoreEKEventEKCalendar主题上学习了更多内容,所以我做得很简单。首先,我从我的设备(iPod Touch)中检索了所有日历。然后使用此代码

将所有日历存储在NSArray中
    EKEventStore *eventStore = [[[EKEventStore alloc] init] autorelease]; 
    caleandarsArray = [[NSArray alloc] init];
    caleandarsArray = [[eventStore calendars] retain];

然后通过此代码将事件添加到所选日历

EKCalendar *calendar = [caleandarsArray objectAtIndex:1];
[events setCalendar:calendar];
NSError *err;
[eventStore saveEvent:events span:EKSpanThisEvent error:&err];

通过使用上面的代码,我们可以将事件添加到欲望日历中。感谢。

答案 1 :(得分:0)

Aldee Mativo先生。谢谢。我没有在我的项目中使用Google API。所以,我不知道如何使用Google Calendar API。我得到了在iPhone中使用Google日历API的指南。请阅读这个。

http://code.google.com/apis/calendar/data/2.0/developers_guide_protocol.html

我不知道它对你有用。别误会我。感谢。