Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用JSON和iPhone设置CellTextLabel_Iphone_Json_Ios4_Sdk - Fatal编程技术网

使用JSON和iPhone设置CellTextLabel

使用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

我只是第一次尝试使用JSON。但我的数据是日文的,但它以UTF格式显示在单元格中(\u358\u798\u789等等)

请看一下我的代码

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:@“\”“]”]; 而且它也不起作用。