how to pass a nil value for one of the parameter in alamofire Post request

后端 未结 4 1303
不思量自难忘°
不思量自难忘° 2021-01-17 16:02

I would like to pass a nil value i.e., optional to one of the parameter value. And it must proceed with the nil value in the Alamofire Post request .It woul

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-17 16:40

    I think your simplest answer would be to add "profile_picture" as a second step.

    var parameters = [
        "first_name": "XXXXX",
        "email" : "1234@gmail.com",
        "password" : "password"]
    
    if let base64String = base64String where !base64String.isEmpty {
        parameters["profile_picture"] = base64String
    }
    

提交回复
热议问题