0

如何从 NSMutableArray 的事件中访问位置值。当我尝试使用 NSLog(@"Event Title:%@", [[events objectAtIndex:i] location]); 时,编译器抛出多个名为 'location' 的方法,发现结果、参数类型或属性不匹配。如何从此事件中获取位置值。

事件(“EKEvent <0x94a9360>\n{\n\t EKEvent <0x94a9360>\n{\t 标题 = \t\tSdsdfsd;\n\t位置= \t(null);\n\t 日历 = \tEKCalendar <0x9497b90> {title = 日历;type = Local;allowsMo​​dify = YES;color = #1BADF8;};\n\t 警报 = \t\t(null);\n\t URL = \t\t\t( null); \n\t lastModified = 2014-07-31 13:35:52 +0000; \n\t timeZone = \tAsia/Kolkata (GMT+5:30) offset 19800 \n}; \n\t location = \t(null); \n\t startDate = \t2014-08-01 13:30:00 +0000; \n\t endDate = \t\t2014-08-01 14:30:00 +0000; \ n\t allDay = \t\t0; \n\t 浮动 = \t0; \n\t 重复 = \t(null); \n\t 参加者 = \t(null) \n};" )

4

1 回答 1

0

如果您有 EKEvent 对象的数组,那么您可以遍历数组以获取所需的数据,如下所示

for (int i = 0; i < events.count; i++)
{
   EKEvent *event = [events objectAtIndex:i];
   NSLog(@"Title: %@\n",event.title);
   NSLog(@"Location: %@\n",event.location);
   NSLog(@"TimeZone: %@\n",event.timeZone);
   NSLog(@"StartDate: %@\n",event.startDate);
   NSLog(@"EndDate: %@\n",event.endDate);
}
于 2014-08-01T11:17:55.627 回答