Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

205
Views
La respuesta JSON de carga de Alamofire no se compila

Estoy haciendo una carga de Alamofire en el servidor y quiero decodificar algunos JSON que se envían como respuesta.

 AF.upload(multipartFormData: { multiPart in //do upload stuff to the server here }, to: server) .uploadProgress(queue: .main, closure: { progress in //Current upload progress of file print("Upload Progress: \(progress.fractionCompleted)") }) .responseJSON(completionHandler: { data in guard let JSON = data.result.value else { return } print("JSON IS \(JSON)") //decode the JSON here... })

En la línea donde estoy protegiendo que data.result.value tiene un valor (la respuesta JSON enviada desde el servidor), obtengo un 'Tipo de expresión es ambiguo sin más contexto'.

El código para enviar el objeto JSON desde el servidor se ve así en el lado de Node.js:

 app.post('/createCommunity', upload.single('cameraPhoto'), async function (request, response) { // do operations to get required variables var returnObject = { community_id: id, title: title, members: members, image: imageURL } response.send(returnObject) }

¿Algunas ideas?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Dado que ya tiene una estructura Community codificable/descifrable, pruebe este enfoque:

 AF.upload(multipartFormData: { multipartFormData in //do upload stuff to the server here }, to: server) .responseDecodable(of: Community.self) { response in debugPrint(response) }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!