Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

195
Visualizações
Ambiguous reference to member async execute in completion block AWS S3 Swift 3

While trying to use the AWSTransferutility to upload photos with Swift, I get this error. Ambiguous reference to member async(execute:) I searched similar questions but didn't find solution.

func uploadS3Background (dict: NSMutableDictionary) {

    let  transferUtility = AWSS3TransferUtility.default()
    let expression = AWSS3TransferUtilityUploadExpression()
    
    
    let completionHandler = { (task, error) -> Void in
        
        DispatchQueue.main.async(execute: {
            
        })
    }
    
    transferUtility.uploadFile(URL(fileURLWithPath: dict.object(forKey: "url") as! String),
    bucket: "bucketname/images",
    key: (dict.object(forKey: "filename") as! String),
    contentType: "image/png",
    expression: expression,
    completionHandler).continueWith { (task) -> AnyObject! in
        
        if let error = task.error
        {
            print("Error: \(error.localizedDescription)")
        }
            
        if let _ = task.result
        {
            // Do something with uploadTask.
        }
        
        return nil;
    }
}

Outside of a completion block I don't get the error for dispatching on the main queue.

enter image description here

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Declare this in your view controller -

var completionHandler: AWSS3TransferUtilityUploadCompletionHandlerBlock?

and then use

self.completionHandler = { (task, error) -> Void in
            DispatchQueue.main.async(execute: {

      })
}
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda