2. copy JSONKit.h and JSONKit.m files to your project
3.sample codes (记得import JSONKit.h)
NSString* strUrl=@"xxxx"; //it return json format string
NSURL *url=[NSURL URLWithString:strUrl];
NSMutableURLRequest *request=[[NSMutableURLRequest alloc] initWithURL:url];
NSError *err=nil;
NSData *jsonData=[NSURLConnection sendSynchronousRequest:request
returningResponse:nil
error:&err];
NSDictionary *resultsDictionary = [jsonData objectFromJSONData];
NSLog(@"resultsDictionary=%@", resultsDictionary );
本文介绍了如何通过下载并使用JSONKit库来解析JSON格式的数据。具体步骤包括从GitHub下载JSONKit,将其添加到项目中,并通过示例代码演示如何发送同步请求获取JSON数据并转换为NSDictionary对象。
180

被折叠的 条评论
为什么被折叠?



