我已将 SBJson
文件夹复制到我的项目中,并且 #import "SBJson.h"
但是我还是没有得到
NSDictionary *result = [strResult JSONValue];
即使 Xcode 也不显示任何选项 JSONValue
;
即使我写 JSONValue
也会提示我错误
No visible @interface for 'NSString' declares the selector 'JSONValue'
最佳答案
为此你不需要 SBJson
。
有一个本地类 NSJSONSerialization
可以更快地执行此操作,并且无需导入任何内容。
NSDictionary *result = [NSJSONSerialization JSONObjectWithData:[strResult dataUsingEncoding:NSUTF8StringEncoding] options:0 error:nil];
更好的方法是直接使用他请求的 NSData
...
NSDictionary *result = [NSJSONSerialization JSONObjectWithData:theJSONDataFromTheRequest options:0 error:nil];
关于ios - "JSONValue"使用 SBJson 时关键字未被识别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17696800/