ios - 应用程序在 swift 3 的 AWS S3 存储桶中上传图像时崩溃
<p><p>在我的应用程序中,我正在尝试使用 AWS S3 上传图像。但是,当我从库中选择图像或捕获的图像时,在上传过程中我的应用程序崩溃了。 </p>
<pre><code>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)")
}
</code></pre>
<p>应用程序在 let transferUtility = AWSS3TransferUtility.default() 处崩溃</p>
<p>所以请提出任何解决方案。将不胜感激。谢谢。</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>这个问题可能是由于 AWS S3 pod 更新而出现的。请检查最新的 pod。请查看 <a href="https://github.com/aws/aws-sdk-ios" rel="noreferrer noopener nofollow">https://github.com/aws/aws-sdk-ios</a> </p></p>
<p style="font-size: 20px;">关于ios - 应用程序在 swift 3 的 AWS S3 存储桶中上传图像时崩溃,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/42152318/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/42152318/
</a>
</p>
页:
[1]