

点击上方

蓝字
关注我们

原文链接:https://blog.csdn.net/z929118967/article/details/105138207
如果后台Bool 参数没有同时支持【 0,1】 ;和【 true false】,get请求的时候 就需要特殊处理。
使用NSNumber 传BOOL值的时候,get 和post对应的参数不一致
[params setValue:[NSNumber numberWithBool:self.viewModel.multipleSwitchCellTableViewCellModel.IsSon] forKey:@"IsSon"];//
这个代码使用Post 会将请求参数IsSon 自动转为true/false

在这里插入图片描述
但是get 请求的时候就是默认0和1 不会进行将参数IsSon 自动转为true/false

在这里插入图片描述