简体   繁体   English

在Xcode中解析Google日历

[英]Parsing google calendar in xcode

I am attempting to add an event schedule to an iOS / xcode app that I am working on. 我正在尝试向我正在处理的iOS / xcode应用程序添加事件时间表。 I have been able to parse the google calendar feed using Michael Waterfalls' code at https://github.com/mwaterfall/MWFeedParser but I have not been able to replace the date the post was created with the date the event is scheduled. 我已经可以使用https://github.com/mwaterfall/MWFeedParser上的迈克尔瀑布(Michael Waterfalls)代码解析Google日历供稿,但是我无法用计划活动的日期替换帖子创建的日期。

The feed url is placed in the RootViewController.m file and I am using this feed http://www.google.com/calendar/feeds/firstpentecostalchurch.com_e2hia2v3bc766ff9397qu3eqa8%40group.calendar.google.com/public/basic 供稿网址位于RootViewController.m文件中,我正在使用此供稿http://www.google.com/calendar/feeds/firstpentecostalchurch.com_e2hia2v3bc766ff9397qu3eqa8%40group.calendar.google.com/public/basic

I am sure this is easy, I must be missing something as the heavy lifting is already done. 我确信这很容易,因为已经完成了繁重的工作,所以我一定想念一些东西。

The event dates you are looking for don't have an XML tag associated with them. 您要查找的活动日期没有与之关联的XML标记。 That's to be expected because they aren't part of the RSS specification. 这是可以预期的,因为它们不是RSS规范的一部分。 The event dates are embedded in the text of the <summary> and <content> tags, which contain HTML. 事件日期嵌入在包含HTML的<summary>和<content>标记的文本中。

It appears that the event dates at least have consistent patterns (one for recurring events and another for single events). 看来事件日期至少具有一致的模式(一个用于重复事件,另一个用于单个事件)。 For example, single event summaries seem to appear at the beginning in a long date format prefixed by a "When: ". 例如,单个事件摘要似乎以带有“ When:”前缀的长日期格式出现在开头。

You could use regular expressions to pull out the dates, but you might have to add logic for the recurring events to calculate all the the specific dates. 您可以使用正则表达式提取日期,但可能必须为重复事件添加逻辑以计算所有特定日期。 And if the maintainer of the feed changes their format, your interface will break. 而且,如果Feed的维护者更改了其格式,您的界面就会中断。 You can try to anticipate that somewhat by looking for multiple different date patterns, but that only goes so far. 您可以通过寻找多个不同的日期模式来尝试预料到这一点,但这只是到目前为止。

我建议您改用Calendar API v3,因为不建议使用GData供稿https://developers.google.com/google-apps/calendar/v2/developers_guide_protocol

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM