gpt4 book ai didi

swift - 在向 AWS 存储发送 put 请求期间获取 "the request is time out"

转载 作者:行者123 更新时间:2023-11-30 10:35:03 25 4
gpt4 key购买 nike

我尝试将 PUT 请求发送到以下链接以将数据上传到 AWS 存储:

"https://jpcloud01.s3.amazonaws.com/134/111067134/872/1d38b212-9753-4d02-b87e-fa7f90d95990.mp4?AWSAccessKeyId=XXXXXXXXXXXXXXX&Expires=1570334549&Signature=YYYYYYYYYYYYYY" 

但是控制台总是显示消息:

NSLocalizedDescription=The request timed out., NSErrorFailingURLStringKey=https://jpcloud01.s3.amazonaws.com/134/111067134/872/1d38b212-9753-4d02-b87e-fa7f90d95990.mp4?AWSAccessKeyId=XXXXXXXXXXXXXXX&Signature=YYYYYYYYYYYYYY, NSErrorFailingURLKey=https://jpcloud01.s3.amazonaws.com/134/111067134/872/1d38b212-9753-4d02-b87e-fa7f90d95990.mp4?AWSAccessKeyId=XXXXXXXXXXXXXXX&Expires=1570334549&Signature=YYYYYYYYYYYYYY, _kCFStreamErrorDomainKey=4} [-1001]

这是我发送 PUT 请求的代码段:

使用 Alamofire 5.0/Swift 5.0

        let _ = AF.upload(fileURL, to: uploadURL, method: .put)
.response {
response in
switch response.result {
case .success( _):
if let dataHeader = response.response?.allHeaderFields {
print(dataHeader)
}
break
case .failure(let error):
print(error)
break
}
if let statusCode = response.response?.statusCode {
print(statusCode)
}
}
.uploadProgress {
(progeress) in
let fProgress = Float(progeress.fractionCompleted)
print("fProgress = \(fProgress)")
}

最佳答案

该错误消息通常表示您的数据太大,无法及时成功上传。也许尝试较小的文件或更好的互联网条件。

关于swift - 在向 AWS 存储发送 put 请求期间获取 "the request is time out",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58213215/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com