'-[__NSCFArray allKeys]: unrecognized selector sent to instance 0xaa795c0'
在执行解析json时候的报错信息.
是怎么回事?
- (NSString *)stringFormDict:(NSDictionary*)dict
{
NSMutableString *str = [NSMutableString string];
NSArray *keys = [dict allKeys];
for (NSString *key in keys) {
if ([[dict objectForKey:key] isKindOfClass:[NSDictionary class]]) {
id obj = [dict objectForKey:key];
[str appendFormat:@"n%@: %@",key,[self stringFormDict:obj]];
}else if ([[dict objectForKey:key] isKindOfClass:[NSArray class]]){
[str appendFormat:@"n%@:",key];
for (id obj in [dict objectForKey:key]) {
[str appendFormat:@"n%@",[self stringFormDict:obj]];
}
}else{
[str appendFormat:@"n%@: %@",key,[dict objectForKey:key]];
}
}
return str;
}