Chi*_*tri 3 json objective-c ios sbjson
我已将SBJson文件夹复制到我的项目中#import "SBJson.h"
但我仍然没有得到
NSDictionary *result = [strResult JSONValue];
Run Code Online (Sandbox Code Playgroud)
甚至Xcode都没有显示任何选项JSONValue;
即使我写JSONValue它比它提示我错误
No visible @interface for 'NSString' declares the selector 'JSONValue'
Run Code Online (Sandbox Code Playgroud)
Fog*_*ter 18
你不需要SBJson这个.
有一个本机类NSJSONSerialization可以更快地执行此操作,无需导入任何内容.
NSDictionary *result = [NSJSONSerialization JSONObjectWithData:[strResult dataUsingEncoding:NSUTF8StringEncoding] options:0 error:nil];
Run Code Online (Sandbox Code Playgroud)
一个更好的方法就是直接使用NSData他要求的......
NSDictionary *result = [NSJSONSerialization JSONObjectWithData:theJSONDataFromTheRequest options:0 error:nil];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6412 次 |
| 最近记录: |