I'm trying to set up an S3 to store profile images for my iOS client. I had it working but I my partner on the other side of the country couldn't upload so were messing around, and now I can't upload either. I can still download the images that are there but that's all.
Here is the code I'm using to upload them:
let credentialsProvider = AWSCognitoCredentialsProvider(regionType:.USWest2, identityPoolId: myIdentityPoolId)
let configuration = AWSServiceConfiguration(region:.USWest2, credentialsProvider:credentialsProvider)
AWSServiceManager.defaultServiceManager().defaultServiceConfiguration = configuration
let uploadRequest = AWSS3TransferManagerUploadRequest()
uploadRequest.body = generateImageUrl(remoteName, image: image)
uploadRequest.key = remoteName
uploadRequest.bucket = S3BucketName
uploadRequest.contentType = "image/jpeg"
let transferManager = AWSS3TransferManager.defaultS3TransferManager()
// Perform file upload
transferManager.upload(uploadRequest).continueWith(executor: AWSExecutor.mainThreadExecutor(), block: { (task:AWSTask) -> AnyObject? in
if let error = task.error {
if error.domain == AWSS3TransferManagerErrorDomain, let code = AWSS3TransferManagerErrorType(rawValue: error.code) {
switch code {
case .Cancelled, .Paused:
break
default:
print("Error uploading: \(uploadRequest.key)")
}
} else {
print("Error uploading: \(uploadRequest.key)")
}
return nil
}
let uploadOutput = task.result
print("Upload complete for: \(uploadRequest.key)")
return nil
I'm getting these errors:
2017-03-08 ... [] nw_endpoint_flow_prepare_output_frames [10.1 52.218.128.128:443 ready socket-flow (satisfied)] Failed to use 1 frames, marking as failed
2017-03-08 ... [] nw_endpoint_handler_add_write_request [10.1 52.218.128.128:443 failed socket-flow (satisfied)] cannot accept write requests
2017-03-08 ... [] __tcp_connection_write_eof_block_invoke Write close callback received error: [22] Invalid argument
2017-03-08 ... AWSiOSSDK v2.5.1 [Error] AWSURLSessionManager.m line:212 | -[AWSURLSessionManager URLSession:task:didCompleteWithError:] | Session task failed with error: Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={NSUnderlyingError=0x17005c560 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "(null)" UserInfo={_kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4}}, NSErrorFailingURLStringKey=<myUrl>, NSErrorFailingURLKey=<myUrl>, _kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey=-2102, NSLocalizedDescription=The request timed out.}
Any pointers would be much appreciated. This is the first time I have used S3 and I'm still pretty lost. Thanks in advance!
SOLVED: So it turns out that my friend had a different version of the pods and when I pulled his version I got the out of date ones too. We struggled for about a week before we found the solution, pod update. 🤦
TL/DR: pod update