使用JSON和iPhone设置CellTextLabel
我只是第一次尝试使用JSON。但我的数据是日文的,但它以UTF格式显示在单元格中(\u358\u798\u789等等) 请看一下我的代码使用JSON和iPhone设置CellTextLabel,iphone,json,ios4,sdk,Iphone,Json,Ios4,Sdk,我只是第一次尝试使用JSON。但我的数据是日文的,但它以UTF格式显示在单元格中(\u358\u798\u789等等) 请看一下我的代码 NSError *theError = nil; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://www.blahblah.com"]]; NSURLResponse *theResponse =[[NSURLRes
NSError *theError = nil;
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://www.blahblah.com"]];
NSURLResponse *theResponse =[[NSURLResponse alloc]init];
NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&theResponse error:&theError];
NSMutableString *string = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
//NSDictionary *jsonDictionaryResponse = [string JSONValue];
self.city = [NSMutableArray arrayWithArray:[string componentsSeparatedByString:@"\""]];
dictionary和JSONValue可以做什么?
我如何用日语展示它?我的编码错了吗
非常感谢您的帮助?您必须首先解析json文件。Objective-C的主要JSON解析库包括:
因此,首先解析JSON文件,然后将值分配给self.city(我没有看到任何其他错误)。您必须首先解析JSON文件。Objective-C的主要JSON解析库包括:
因此,首先解析JSON文件,然后将值分配给self.city(我没有看到任何其他错误)。我尝试self.city=[NSMutableArray arrayWithArray:[[string JSONValue]ComponentSeparatedByString:@“\”“]”;但它也不起作用。我尝试self.city=[NSMutableArrayWithArray:[string JSONValue]ComponentSeparatedByString:@“\”“]”]; 而且它也不起作用。