从 JSON 接收到的数据,如下所示:
{
myself = 1;
"id" = 123;
}
我把它放到了一个NSDictionary *messageDic中,我还定义了一个值*isMyself来接收自己的值
Boolean isMyself = [messageDic objectForKey:@"myself"];
但它不起作用。
所以我打印日期类型,
const char* className = class_getName([[messageDic objectForKey:@"myself"] class]);
NSLog(@"yourObject is a: %s", className);
NSLog(@"Size of BOOL %d", sizeof(isMyself));
NSLog(@"Size of BOOL %@", [messageDic objectForKey:@"myself"]);
结果是:
2012-08-01 17:41:48.886 yourObject is a: __NSCFBoolean
2012-08-01 17:41:48.887 Size of BOOL 1
2012-08-01 17:41:48.887 Size of BOOL 0
并且下面的 if 部分也不起作用。
if ([messageDic objectForKey:@"myself"] == 0)
我试过了
NSCFBoolean *isMyself = [messageDic objectForKey:@"myself"];
我得到了上面的错误表格。
我的问题是我应该怎么做才能测试 的值[messageDic objectForKey:@"myself"]
?什么是__NSCFBoolean
?
谢谢!