AFNetworking提示3840 Unescaped control character around character XXX

处理办法:找到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;

}

上一篇:zabbix结合grafana打造炫酷监控界面


下一篇:可视化工具Grafana:简介及安装