Ios 解析Nsmutabledictionary并提取值
大家好,我有一个问题,在解析字典这里是字典Ios 解析Nsmutabledictionary并提取值,ios,objective-c,json,nsdictionary,nsmutabledictionary,Ios,Objective C,Json,Nsdictionary,Nsmutabledictionary,大家好,我有一个问题,在解析字典这里是字典 { "@id" = 10; activityLocation = ""; activityPriority = 1; actualEndDate = "<null>"; actualStartDate = "<null>"; children = ( ); } 请告诉我哪里出了问题您应该使用objectForKey:而不是valueForK
{
"@id" = 10;
activityLocation = "";
activityPriority = 1;
actualEndDate = "<null>";
actualStartDate = "<null>";
children = (
);
}
请告诉我哪里出了问题您应该使用
objectForKey:
而不是valueForKey:
-
NSNumber *id_user = [dictResponce objectForKey:@"@id"];
看起来id对象实际上是一个
NSNumber
而不是NSString
,所以我也改变了这一点。您应该使用objectForKey:
而不是valueForKey:
-
NSNumber *id_user = [dictResponce objectForKey:@"@id"];
看起来id对象实际上是一个
NSNumber
而不是NSString
,所以我也改变了这一点。您不能使用valueForKey:
方法从NSDictionary获取相应的对象,它应该是NSString*id\u user=[dictresponse objectForKey:@“@id”]代码>
要获取带有valueForKey:
的ann对象,它应该是一个NSMutableDictionary
编辑:
实际问题不是valueForKey:
方法,错误在键中,不能在valueForKey:
方法中使用前导的@
,因为@
用于@sum
和@count
等集合运算符(它在valueForKeyPath:
method中,我不知道为什么它在valueForKey:
method中也出现trowing异常)
Ref:您不能使用valueForKey:
方法从NSDictionary获取相应的对象,它应该是NSString*id\u user=[dictResponse objectForKey:@“@id”];
要获取带有valueForKey:
的ann对象,它应该是一个NSMutableDictionary
编辑:
实际问题不是valueForKey:
方法,错误在键中,不能在valueForKey:
方法中使用前导的@
,因为@
用于@sum
和@count
等集合运算符(它在valueForKeyPath:
method中,我不知道为什么它在valueForKey:
method中也出现trowing异常)
参考:
NSNumber *id_user = [dictResponce objectForKey:@"@id"];