[英]Unable to upload files into S3 bucket through iOS 11.4.1 (AWS-IOS-SDK-2.6.24)
I'm facing issue while uploading the files on AWS S3 bucket (using AWS-IOS-SDK-2.6.24) from iOS 11.4.1 devices. 从iOS 11.4.1设备上传AWS S3存储桶中的文件(使用AWS-IOS-SDK-2.6.24)时遇到问题。 The same code works fine for iOS 9.xx 相同的代码适用于iOS 9.xx
Mostly I'm getting timeout error: 通常,我收到超时错误:
Request headers:
{
"Content-Type" = "application/x-amz-json-1.1";
Host = "cognito-identity.ap-south-1.amazonaws.com";
"User-Agent" = "aws-sdk-iOS/2.6.24 iOS/11.4 en_US";
"X-Amz-Date" = 20180718T080347Z;
"X-Amz-Target" = "AWSCognitoIdentityService.GetCredentialsForIdentity";
}
2018-07-18 12:03:47:866 AWR_Vehicle_Recieving[672:656549] Request body:
{"IdentityId":"ap-south-1:999df51b-5cef-49aa-a566-369a4af76c37"}
2018-07-18 12:03:51.026657+0400 AWR_Vehicle_Recieving[672:656552] [] tcp_timers tcp[2] retransmit SYN 3
2018-07-18 12:03:51.288385+0400 AWR_Vehicle_Recieving[672:656552] [] tcp_timers tcp[3] retransmit SYN 3
2018-07-18 12:03:52.033153+0400 AWR_Vehicle_Recieving[672:656551] [] tcp_timers tcp[2] retransmit SYN 4
2018-07-18 12:03:52.290329+0400 AWR_Vehicle_Recieving[672:656551] [] tcp_timers tcp[3] retransmit SYN 4
2018-07-18 12:03:53.034734+0400 AWR_Vehicle_Recieving[672:656552] [] tcp_timers tcp[2] retransmit SYN 5
2018-07-18 12:03:53.291663+0400 AWR_Vehicle_Recieving[672:656552] [] tcp_timers tcp[3] retransmit SYN 5
2018-07-18 12:03:55.041617+0400 AWR_Vehicle_Recieving[672:656591] [] tcp_timers tcp[2] retransmit SYN 6
2018-07-18 12:03:55.298220+0400 AWR_Vehicle_Recieving[672:656591] [] tcp_timers tcp[3] retransmit SYN 6
2018-07-18 12:03:59.048019+0400 AWR_Vehicle_Recieving[672:656549] [] tcp_timers tcp[2] retransmit SYN 7
2018-07-18 12:03:59.304982+0400 AWR_Vehicle_Recieving[672:656549] [] tcp_timers tcp[3] retransmit SYN 7
2018-07-18 12:04:00.003149+0400 AWR_Vehicle_Recieving[672:656478] Status bar could not find cached time string image. Rendering in-process.
2018-07-18 12:04:07.054542+0400 AWR_Vehicle_Recieving[672:656552] [] tcp_timers tcp[2] retransmit SYN 8
2018-07-18 12:04:07.314792+0400 AWR_Vehicle_Recieving[672:656552] [] tcp_timers tcp[3] retransmit SYN 8
2018-07-18 12:04:23.061853+0400 AWR_Vehicle_Recieving[672:656552] [] tcp_timers tcp[2] retransmit SYN 9
2018-07-18 12:04:23.327710+0400 AWR_Vehicle_Recieving[672:656552] [] tcp_timers tcp[3] retransmit SYN 9
2018-07-18 12:04:48.807451+0400 AWR_Vehicle_Recieving[672:656955] Task <4E4BA101-41B3-4A33-905F-9BC082F5B45B>.<1> finished with error - code: -1001
2018-07-18 12:04:48.825138+0400 AWR_Vehicle_Recieving[672:656955] Task <4E4BA101-41B3-4A33-905F-9BC082F5B45B>.<1> HTTP load failed (error code: -999 [1:89])
2018-07-18 12:04:48:826 AWR_Vehicle_Recieving[672:656880] Session task failed with error: Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={NSUnderlyingError=0x1c084dda0 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "(null)" UserInfo={_kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4}}, NSErrorFailingURLStringKey=https://cognito-identity.ap-south-1.amazonaws.com/, NSErrorFailingURLKey=https://cognito-identity.ap-south-1.amazonaws.com/, _kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey=-2102, NSLocalizedDescription=The request timed out.}
I'm following the AWS Documentation, all the required details I gathered from AWS documentations only. 我正在关注AWS文档,仅从AWS文档中收集了所有必需的详细信息。
I've configured my info.plist and also added awrconfiguration.json into my project. 我已经配置了info.plist ,还将awrconfiguration.json添加到了我的项目中。
I've mentioned the credentials in my AppDelegate Class: 我在AppDelegate类中提到了凭据:
AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc]
initWithRegionType:AWSRegionAPSouth1
identityPoolId:@"ap-south-1:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”];
AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionAPSouth1
credentialsProvider:credentialsProvider];
[AWSServiceManager defaultServiceManager].defaultServiceConfiguration = configuration;
I'm unable to understand what I'm doing wrong here as the code works fine in older versions of iOS. 我无法理解我在这里做错了什么,因为该代码在旧版iOS中可以正常工作。
My Other question is: If we really need to provide the credentials in the AppDelegate Class, then why do we need to configure info.plist or why need to copy awsconfiguration.json file into our project. 我的另一个问题是:如果确实需要在AppDelegate类中提供凭据,那么为什么我们需要配置info.plist或为什么需要将awsconfiguration.json文件复制到我们的项目中。 What is the way to read the credentials from info.plist or read the awsconfiguration file programmatically, without defining credentials in the AppDelegate.m file ? 在不定义AppDelegate.m文件中的凭据的情况下,以什么方式从info.plist读取凭据或以编程方式读取awsconfiguration文件的方法是什么?
This is a partial answer. 这是部分答案。
Hi, 你好
First, to clear up the confusion. 首先,要消除混乱。 You only need one: 您只需要一个:
awsconfiguration.json
Info.plist
Second, to access the configuration from either awsconfiguration.json
-or- Info.plist
you may construct: 其次,无论从访问配置awsconfiguration.json
-或- Info.plist
你可以构造:
AWSS3TransferUtility *transferUtility = [AWSS3TransferUtility defaultS3TransferUtility];
Can you try only the code based approach and reply here while I debug further? 当我进一步调试时,您能否仅尝试基于代码的方法并在此处回复?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.