使用SBJson时,“JSONValue”关键字不被识别?

我已经将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]; 

如果你还想用SBJsonreplace#import “SBJSON.h”和#import “JSON.h” ,你就可以使用它。