1
嘗試使用AWSTransferutility通過Swift上傳照片時,出現此錯誤。模糊引用成員異步(執行:)我搜索了類似的問題,但沒有找到解決方案。在完成塊中對成員異步執行的模糊引用AWS S3 Swift 3
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;
}
}
在完成塊之外,我沒有在主隊列上分派錯誤。