解析EKEvent描述文本

时间:2013-04-12 11:36:31

标签: parsing ekevent

我目前正在开发一个上传EKEvent event.description的iOS应用程序,这是一个基本的NSString。

问题是,当我上传文件后从服务器下载文件时,解析字符串很麻烦。

目前,这是我在下载文本文件

时查看的字符串

"EKEvent <0x9dd50b0> {EKEvent <0x9dd50b0> {title = Another Event SC; location = A House; calendar = EKCalendar <0x994e7f0> {title = Calendar; type = Local; allowsModify = YES; color = #0E61B9;}; alarms = (null); URL = (null); lastModified = 2013-04-11 20:44:58 +0000; timeZone = (null)}; location = A House; startDate = 2012-10-11 07:00:00 +0000; endDate = 2012-10-13 06:59:59 +0000; allDay = 1; floating = 1; recurrence = (null); attendees = (null)}"

我认为解析这个文件不会很糟糕,但我对目标C相当新。

这是我到目前为止所做的事情

NSString *anotherString = [NSString stringWithFormat:components[i]];
NSLog(@"%@", anotherString);

//EKEventStore *eventStore = [[EKEventStore alloc] init];
//EKEvent *event  = [EKEvent eventWithEventStore:eventStore];

NSArray *totalEventInfo = [anotherString componentsSeparatedByString:@"= "];

NSLog(@"%@",totalEventInfo);

假设anotherString包含先前显示的下载文本文件字符串。在分离字符串并将每个单独的字符串存储到totalEventInfo的增量组件之后继承输出。

"EKEvent <0x9dbe430> {EKEvent <0x9dbe430> {title ",
"Another Event SC; location ",
"A House; calendar ",
"EKCalendar <0x99e9570> {title ",
"Calendar; type ",
"Local; allowsModify ",
"YES; color ",
"#0E61B9;}; alarms ",
"(null); URL ",
"(null); lastModified ",
"2013-04-11 20:44:58 +0000; timeZone ",
"(null)}; location ",
"A House; startDate ",
"2012-10-11 07:00:00 +0000; endDate ",
"2012-10-13 06:59:59 +0000; allDay ",
"1; floating ",
"1; recurrence ",
"(null); attendees ",
"(null)}"

如何指定字符串的域名?防爆。从字符串中读入,字符串中的一串字符&#39; =&#39;并结束于下一个&#39 ;;&#39;。

也许这不是解析信息的好方法。

我在想的不是上传一个包含EKEvent的event.description的文件,我会上传一个带有event.title,event.startdate,event.enddate等的文件而不是event.description并且必须解析每次下载文件。

建议或意见表示赞赏:)

0 个答案:

没有答案