向后台发送json数据
2016-09-21 本文已影响101人
贺乾龙
//将字典转为json格式的数据
// NSJSONWritingPrettyPrinted 转化的json数据有换位符 /n
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:_dataDic options:0 error:nil];
NSMutableData *data = [NSMutableData dataWithData:jsonData];
NSString *JsonStr = [[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];
NSInteger uid = [USERUID intValue];
params[@"uid"] = @(uid);
params[@"utoken"] = USERUTOKEN;
params[@"driver"] = JsonStr ;