iCal4ObjC 1.1.0

iCal4ObjC 1.1.0

测试已测试
语言语言 Objective-CObjective C
许可 MIT
发布上次发布2015年4月

Kevin Lohman 维护。



iCal4ObjC 1.1.0

  • Satoshi Konno

---+!! iCal4ObjC

%TOC%

---++ 简介

iCal4ObjC 是一个 Objective-C 实现,符合 [[http://tools.ietf.org/html/rfc2445][RFC2455]] 中定义的 iCalendar 规范,主要用于 iOS 和 MacOSX 平台,如 iPhone 和 iPad。它支持轻松读取或写入 iCalendar 流中的组件。更多详细信息,请查看 [[http://www.cybergarage.org/doxygen/ical4objc/][the doxygen 文档]]。

---++ 最新更新

v 1.1.0 - ARC 支持,CocoaPod 规范

---++ 安装

---+++ 获取 SDK 包

  1. 从以下网站获取 SDK 包。

| GitHub | https://github.com/cybergarage/iCal4ObjC |

  1. 将 iCalObjCSDK 添加到您的项目中

要在您的 XCode 项目中使用 iCalForObj4,您必须将以下文件添加到 SDK 包的 iCalObjCSDK 子文件夹中。

CGICalendar.h CGICalendar.m CGICalendarComponent.h CGICalendarComponent.m CGICalendarContentLine.h CGICalendarContentLine.m CGICalendarObject.h CGICalendarObject.m CGICalendarParameter.h CGICalendarParameter.m CGICalendarProperty.h CGICalendarProperty.m CGICalendarValue.h CGICalendarValue.m NSDate+CGICalendar.h NSDate+CGICalendar.m

---++ 使用

---+++ 解析 iCalendar 对象

要解析现有的 iCalendar 流或字符串,使用 !CGICalendar::parse,如下所示。

import "CGICalendar.h"

CGICalendar *ical = [[CGICalendar alloc] init]; if ([ical parseWithPath:icalPath error:nil]) { .......... }

要遍历 iCalendar 中的所有对象、组件、属性和参数,使用 !CGICalendar::objects、!CGICalendarObject::components、!CGICalendarComponent::properties 和 !CGICalendarProperty:: parameters,如下所示。

for (CGICalendarObject *icalObj in [self objects]) { for (CGICalendarComponent *icalComp in [icalObj components]) { NSString *icalCompType = [icalComp type]; .......... for (CGICalendarProperty *icalProp in [icalComp properties]) { NSString *icalPropName = [icalProp name]; NSString *icalPropValue = [icalProp value]; .......... for (CGICalendarParameter *icalParam in [icalProp parameters]) { NSString *icalParamName = [icalProp name]; NSString *icalPropValue = [icalProp value]; .......... } } } }

---+++ 添加对象、组件或属性

要将对象、组件和属性添加到 iCalendar 实例中,使用 !CGICalendar::addObject:、!CGICalendarObject::addComponent: 和 !CGICalendarComponent::addProperty:,如下所示。

CGICalendar *ical = [[CGICalendar alloc] init];

// 添加对象 CGICalendarObject *icalObj = [[[CGICalendarObject alloc] initWithProdid:@"//CyberGarage//iCal4ObjC//EN"] autorelease]; [ical addObject:icalObj];

// 添加组件 CGICalendarComponent *icalComp = [[[CGICalendarComponent alloc] initWithType:@"VTODO"] autorelease]; [icalObj addComponent:icalComp];

// 添加属性 CGICalendarProperty *icalProp = [[[CGICalendarProperty alloc] init] autorelease]; [icalProp setName:@"SUMMARY"]; [icalProp setValue:@"Write report"]; [icalComp addComponent:icalProp];

---+++ 编写iCalendar对象

要将iCalendar对象导出为文件,请使用下面的!CGICalendar:writeToFile。

CGICalendar *ical = .......... ......... [ical writeToFile:@"MyToDo.ics"];

---+++ 资源

---+++ 仓库

请访问[GitHub上的项目页面](https://github.com/cybergarage/XPathQuery4ObjC)以获取源代码和示例 :-)

| GitHub | https://github.com/cybergarage/iCal4ObjC | | Doxygen | http://www.cybergarage.org/doxygen/ical4objc/ |