" JSONValue"使用SBJson时无法识别关键字? [英] "JSONValue" Keyword not getting recognised while using SBJson ?

查看:112
本文介绍了" JSONValue"使用SBJson时无法识别关键字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将 SBJson 文件夹复制到我的项目中,并且 #importSBJson.h

i have copied SBJson folder into my project and also #import "SBJson.h"

但我仍未获得

NSDictionary *result = [strResult JSONValue];

即使Xcode也没有显示任何选项 JSONValue ;

Even Xcode does not show any option JSONValue;

即使我写 JSONValue 比它提示我错误

even if i write JSONValue than it prompt me error

No visible @interface for 'NSString' declares the selector 'JSONValue'


推荐答案

你不需要 SBJson

有一个本地类 NSJSONSerialization 可以更快地执行此操作,无需导入任何内容。

There is a native class NSJSONSerialization that does this much faster and without the need to import anything.

NSDictionary *result = [NSJSONSerialization JSONObjectWithData:[strResult dataUsingEncoding:NSUTF8StringEncoding] options:0 error:nil];

更好的方法是使用 NSData 直接来自他的请求......

A better way would just be to use the NSData straight from he request...

NSDictionary *result = [NSJSONSerialization JSONObjectWithData:theJSONDataFromTheRequest options:0 error:nil];

这篇关于" JSONValue"使用SBJson时无法识别关键字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆