处理办法:找到AFNetworking包中AFURLResponseSerialization.m文件在第250行修改代码如下:
if (data.length > 0 && !isSpace) {
NSString* sInvalid = [NSString stringWithUTF8String:[data bytes]];
// 从服务器收到的类似上一行的数据
sInvalid = [sInvalid stringByReplacingOccurrencesOfString:@"\r" withString:@""];
sInvalid = [sInvalid stringByReplacingOccurrencesOfString:@"\t" withString:@""];
NSData *dataa = [[sInvalid stringByReplacingOccurrencesOfString:@"\n" withString:@""] dataUsingEncoding:NSUTF8StringEncoding];
if (dataa == nil) {
dataa = data;
}
responseObject = [NSJSONSerialization JSONObjectWithData:dataa options:self.readingOptions error:&serializationError];
} else {
return nil;
}