我正在尝试在字典中发送一个值作为 null 作为参数的 alamofire post 请求
var time: String?
var dic = ["aaaa:add,
"bbbb":bbbb,
"cccc":cccc,
"dddd": dddd,
"eeee":eeee,
"ffff":ffff,
"gggg":time] as [String : Any]
如何将变量"时间"发送为"空"。
null
值的等效值是NSNull
,如果time
nil
,请使用 nil 合并运算符传递NSNull
实例。
var time: String?
var dic : [String : Any] = ["aaaa":"add",
"bbbb":"bbbb",
"cccc":"cccc",
"dddd": "dddd",
"eeee":"eeee",
"ffff":"ffff",
"gggg":time ?? NSNull()]