Amazon AWS S3 SDK for iOS drops connection (Error -1005)

爱⌒轻易说出口 提交于 2020-01-23 09:29:08

问题


When running the AWSiOSDemoTVM project, the async S3 demo code will start uploading data, but the connection will be dropped after a couple of seconds.

AWSiOSDemoTVM: didFailWithError : Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost."UserInfo=0xb54e850 {NSErrorFailingURLStringKey=https://BUCKETNAME.s3.amazonaws.com/asyncDemoKey, NSErrorFailingURLKey=https://BUCKETNAME.s3.amazonaws.com/asyncDemoKey, NSLocalizedDescription=The network connection was lost., NSUnderlyingError=0xb5527f0 "The network connection was lost."}

Small uploads without using the asynchronous delegate will succeed.


回答1:


I didn't set the correct endpoint for the bucket. The default endpoint only works for US buckets.

In AmazonClientManager.m, add the correct endpoint for your bucket region.

    s3  = [[AmazonS3Client alloc] initWithCredentials:credentials];
    s3.endpoint = @"https://s3-eu-west-1.amazonaws.com";

A list of regional endpoints for S3 and other AWS services can be found here



来源:https://stackoverflow.com/questions/10971707/amazon-aws-s3-sdk-for-ios-drops-connection-error-1005

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!