1. 编码问题。
2. 如果data是有数据的,但是arr是nil,找到error:The operation couldn't be completed. (Cocoa error 3840.)
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:urlString]];NSError *error = nil;NSStringEncoding enc = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000);NSString *dataString = [[NSString alloc] initWithData:data encoding:enc];NSData *utf8Data = [dataString dataUsingEncoding:NSUTF8StringEncoding];NSArray *arr = [NSJSONSerialization JSONObjectWithData:utf8Data options:NSJSONReadingMutableContainers error:&error];3. json非标准格式:(比如json数据存在\n \r \t 等制表符)
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:urlString]];