我从 JSON 提要中提取了一个名为参加的变量。在检查了对象被解释为 I NSLog 的类类型之后:
attending var type is: __NSCFBoolean
这是使用 [varname class] 来获取变量的类类型来完成的。
所以我想看看这是真的还是假的......所以我写了这段代码......:
if([[_events objectAtIndex:indexPath.row] objectForKey:@"attending"] == YES){
但是我无法编译它,因为它给了我一个黄色文本错误说:
我究竟做错了什么?我怎样才能解决这个问题。只需在提要中添加数据,如下所示:
{
attendees = (
);
attending = 1;
date = "2012-09-24 09:11:00";
id = 504;
lessonHTML = "somehtml.";
name = "Sup";
youtubeId = "http://www.youtube.com/watch?v=j1vb4cND3G0";
},
{
attendees = (
);
attending = 1;
date = "2012-09-24 09:11:00";
id = 503;
lessonHTML = "somehtml.";
name = "Sup";
youtubeId = "http://www.youtube.com/watch?v=j1vb4cND3G0";
},
{
attendees = (
);
attending = 0;
date = "2012-09-24 09:11:00";
id = 508;
lessonHTML = "somehtml.";
name = "Sup";
youtubeId = "http://www.youtube.com/watch?v=j1vb4cND3G0";
},
{
attendees = (
);
attending = 1;
date = "2012-09-24 09:11:00";
id = 509;
lessonHTML = "somehtml.";
name = "Sup";
youtubeId = "http://www.youtube.com/watch?v=j1vb4cND3G0";
},
{
attendees = (
);
attending = 0;
date = "2012-09-24 09:11:00";
id = 505;
lessonHTML = "somehtml.";
name = "Sup";
youtubeId = "http://www.youtube.com/watch?v=j1vb4cND3G0";
},
{
attendees = (
);
attending = 1;
date = "2012-09-24 09:11:00";
id = 506;
lessonHTML = "somehtml.";
name = "Sup";
youtubeId = "http://www.youtube.com/watch?v=j1vb4cND3G0";
},