我有一个JSON文件,我正在尝试解析它,如下所示
-(void)loadSuraNames
{
NSURL * url = [NSURL URLWithString:@"http://www.submission.ws/downloads/json/"];
url = [url URLByAppendingPathComponent:@"quran_main.json"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
NSData *response = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
NSError *jsonParsingError = nil;
NSArray *array = [NSJSONSerialization JSONObjectWithData:response options:0 error:&jsonParsingError];
NSLog(@"my Json is empty :( %@", array);
}但我拿不到任何数据。有人知道问题出在哪里吗?
我收到以下错误:
Error Domain=NSCocoaErrorDomain Code=3840“无法完成操作。(Cocoa错误3840.)”(字符278周围的转义序列无效。)UserInfo=0xa47ff60 {字符278周围的NSDebugDescription=Invalid转义序列。}
发布于 2013-04-12 08:35:35
JSON脚本添加了"/“字符,我手动删除了这些字符,问题就解决了:)
https://stackoverflow.com/questions/15960939
复制相似问题