How to send a POST request with nested Dictionary in swift

前端 未结 2 718
花落未央
花落未央 2021-01-15 21:35

I search 100s of posts on StackOverflow but can\'t find any correct answer can anyone help me to solve this mystery.

let param : [String : Any]= [
    \"Serv         


        
2条回答
  •  时光说笑
    2021-01-15 22:08

    You can use in this way

        let customerTckt:[String:Any] = ["RequestID" : requestID ,
        "TaskID" : taskID ,
        "Description" : comments ,
        "TicketTypeID" : 3 ,
        "CustomerID" : customerID ,
        "PriorityID" : 3 ,
        "CustomerTPPID" : TTPIDArray ]
    
        let param : [String : Any] = ["ServiceReqID" : 1 ,
                                      "WebUsersID" : customerID,
                                      "FirstName" : userName,
                                      "LastName" : "" ,
                                   "Company":self.profileValues.customerCompanyName ,
                                      "City" : self.profileValues.customerCityName ,
                                      "Email" : self.profileValues.customerEmail ,
                                      "ContactNo" : self.profileValues.customerContactNumber ,
                                      "Country" : "Pakistan" ,
                                      "PackageChange" : 0 ,
                                      "AddressChange" : 0,
                                      "TelInternetVAS" : 0 ,
                                      "Others" : 0 ,
                                      "Comments" : comments ,
                                      "CSAFNO" : self.profileValues.customerCSAFNo,
                                      "SecondaryContactNo" : "" ,
                                      "CustomerTicket" :customerTckt]
    
    
    func postserviceRequestFeedback(url : String , parameter : [String : Any] , tiket : tiket ){
    Alamofire.request(url, method : .post , parameters : parameter , headers : 
    HTTPHeaders).responseJSON { (response) in
        if response.result.isSuccess{}}
    

提交回复
热议问题