Iphone JSON解析错误
我正在尝试解析一些JSON。我已经传递了一个常量键值和一个字符串,但我在Iphone JSON解析错误,iphone,Iphone,我正在尝试解析一些JSON。我已经传递了一个常量键值和一个字符串,但我在状态数组中接收了16个对象,在ststuse1中接收了20个对象 是否有任何解析步骤出错 我已经包含了JSON解析器的代码 提前谢谢 SBJSON *parser = [[SBJSON alloc] init]; NSString *urlString =[NSString stringWithFormat:@"http://api.shiki.com/api/serch?key=%@&q=%@",apiKey,
状态
数组中接收了16个对象,在ststuse1
中接收了20个对象
是否有任何解析步骤出错
我已经包含了JSON解析器的代码
提前谢谢
SBJSON *parser = [[SBJSON alloc] init];
NSString *urlString =[NSString stringWithFormat:@"http://api.shiki.com/api/serch?key=%@&q=%@",apiKey, string];
NSURL *url = [NSURL URLWithString:urlString];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL: url];
NSData *response = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
NSString *json_string = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding];
NSMutableArray *statuses = nil;
statuses = [[NSMutableArray alloc]init];
statuses = [parser objectWithString:json_string error:nil];
NSMutableArray *statuses0 = [[statuses valueForKey:@"offers"] valueForKey:@"offer"];
NSLog(@"Array Contents: %@", statuses0);
我想这不是你代码中唯一的语法错误
请定义状态和stuse1。我只能看到状态(重新定义2次)和状态0。另外,请发布一个您正在解析的json数据示例,以便我可以查看它。这是否编译?您声明了
状态
3次,但只应声明一次。此外,我没有看到状态1
。