iOS post请求时无法传数组的问题

思路:把数组转化为相应的字符串,看代码

NSMutableArray *array = [NSMutableArray arrayWithCapacity:self.reciviedContacts.count];

第一种情况

for (ContactModel *model in self.reciviedContacts) {

[array addObject:model.staffid];

}

[para setObject:[array componentsJoinedByString:@","] forKey:@"staffList"];

第二种情况

NSData *jsonData = [NSJSONSerialization dataWithJSONObject:array options:NSJSONWritingPrettyPrinted error:nil];

[para setObject:[[NSString alloc]initWithData:jsonData encoding:NSUTF8StringEncoding] forKey:@"letterFujian"];

// para 是字典专门存放参数的

你可能感兴趣的:(iOS post请求时无法传数组的问题)