【问题标题】:Application getting crashed at upload image in AWS S3 bucket for swift 3应用程序在 swift 3 的 AWS S3 存储桶中上传图像时崩溃
【发布时间】:2017-02-10 14:18:35
【问题描述】:

在我的应用程序中,我正在尝试使用 AWS S3 上传图像。但是,当我从库中选择图像或捕获的图像时,在上传过程中我的应用程序崩溃了。

let path:NSString = (NSTemporaryDirectory() as NSString).appendingPathComponent("testImage.png") as NSString
let imageData:NSData = UIImagePNGRepresentation(image)! as NSData
imageData.write(toFile: path as String, atomically: true)
let url:NSURL = NSURL(fileURLWithPath: path as String)
let expression = AWSS3TransferUtilityUploadExpression()
expression.setValue("public-read", forRequestParameter: "x-amz-acl")
expression.setValue("public-read", forRequestHeader: "x-amz-acl" )
let transferUtility = AWSS3TransferUtility.default()

transferUtility.uploadFile(url as URL!, bucket: bucketURL, key: myImageUploadKey , contentType: "image/png", expression: expression, completionHandler: { (task, error) in

if error != nil{
print(error?.localizedDescription ?? "error")
}else{
print(task.response ?? "Response error")
}
})

expression.progressBlock = { (task: AWSS3TransferUtilityTask, progress: Progress) in
print("progress \(progress.fractionCompleted)")
}

应用程序在 let transferUtility = AWSS3TransferUtility.default() 处崩溃

所以请提出任何解决方案。将不胜感激。谢谢。

【问题讨论】:

  • 崩溃日志?错误 ?有什么事吗?

标签: ios amazon-s3 swift3 aws-sdk


【解决方案1】:

这个问题可能是由于 AWS S3 pod 更新而出现的。请检查最新的 pod。请查看此https://github.com/aws/aws-sdk-ios

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-03-13
    • 1970-01-01
    • 1970-01-01
    • 2022-01-26
    • 1970-01-01
    • 2019-04-07
    • 2020-06-01
    • 2019-03-18
    相关资源
    最近更新 更多