2

第1部分:

AWSStaticCredentialsProvider *credentials =   [[AWSStaticCredentialsProvider alloc] initWithAccessKey:@"xxxxxxxxxxx"       secretKey:@"xxxxxxxxxxxx"];
AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionAPNortheast1                                                                        credentialsProvider:credentials];

[AWSServiceManager defaultServiceManager].defaultServiceConfiguration = configuration;
[AWSDDLog sharedInstance].logLevel = AWSDDLogLevelVerbose;
[AWSDDLog addLogger:[AWSDDTTYLogger sharedInstance] ];

第2部分:

AWSS3TransferManagerUploadRequest *uploadRequest = [AWSS3TransferManagerUploadRequest new];

uploadRequest.bucket = @"bucket";
uploadRequest.key = @"tarpath";
uploadRequest.body = [NSURL fileURLWithPath: srcPath]; 

[[transferManager upload:uploadRequest] continueWithExecutor:[AWSExecutor mainThreadExecutor]                                                      withBlock:^id(AWSTask *task) { 

if (task.error) {
    if ([task.error.domain isEqualToString:AWSS3TransferManagerErrorDomain]) 

{return nil;}];
}

info.plist 已准备好 ATS 问题

以下是错误日志:

内容编码:aws-chunked 内容类型:二进制/八位字节流主机:s3-ap-northeast-1.amazonaws.com 传输编码:分块用户代理:aws-sdk-iOS/2.5.9 iOS/10.2 .1 zh_CN 传输管理器 x-amz-content-sha256:STREAMING-AWS4-HMAC-SHA256-PAYLOAD x-amz-date:20170813T133010Z x-amz-decoded-content-length:78670

content-encoding;content-type;host;transfer-encoding;user-agent;x-amz-content-sha256;x-amz-date;x-amz-decoded-content-length
STREAMING-AWS4-HMAC-SHA256-PAYLOAD]
2017-08-13 22:30:10:521 test[1026:597507] AWS4 String to Sign: [AWS4-HMAC-SHA256
20170813T133010Z
20170813/ap-northeast-1/s3/aws4_request
7b0dac3ee72f93ad197c7dd6277c2cf5779e6f13c7009e405cafeb765c45eeb0]
2017-08-13 22:30:10:523 test[1026:597507] Request headers:
{
    Authorization = "AWS4-HMAC-SHA256 Credential=xxxxxxxxxxxxx/20170813/ap-northeast-1/s3/aws4_request,

SignedHeaders=内容编码;内容类型;主机;传输编码;用户代理;x-amz-content-sha256;x-amz-date;x-amz-decoded-content-length,签名=f91f3f9002bfe3ae7ec39c71846efd7c99bdf72d5f8163ac400d476f1055b7e7";"内容编码”=“aws-chunked”;“内容类型”=“二进制/八位字节流”;主机=“s3-ap-northeast-1.amazonaws.com”;“传输编码”=分块;“用户代理”=“aws-sdk-iOS/2.5.9 iOS/10.2.1 zh_CN 传输管理器”;“X-Amz-Date”=20170813T133010Z;“x-amz-content-sha256”=“STREAMING-AWS4 -HMAC-SHA256-PAYLOAD";"x-amz-decoded-content-length" = 78670;} 2017-08-13 22:31:11:117 测试[1026:597507] 会话任务失败并出现错误:Error Domain=URLErrorDomain Code=-1001 "要求 NS2 时。" UserInfo={NSUnderlyingError=0x171056e90 {Error Domain=kCFErrorDomainCFNetwork=-1001 "(null)" UserInfo={_kCFStreamErrorCodeKey=-102, _kCFStreamErrorDomainKey=4}},NSErrorFailingURLStringKey=https://s3-ap-northeast-1.amazonaws.com/zxmdata/thevoice/56334401838871229471503493680_Wanmei2017.aac , NSErrorFailingURLKey= https://s3-ap-northeast-1.amazonaws.com/zxmdata/thevoice/56334401830187120_Wmei203871220_Wanmei253871220_W471 _kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey=-2102, NSLocalizedDescription=要求超时。} 2017-08-13 22:31:11.161499 test[1026:597374] Error: Error Domain=NSURLErrorDomain Code=-1001 "要求时。" UserInfo= {NSUnderlyingError=0x171056e90 {错误域=kCFErrorDomainCFNetwork Code=-1001 "(null)" UserInfo={_kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4}}, NSErrorFailingURLStringKey= https://s3-ap-northeast-1.amazonaws.com/ zxmdata/thevoice/56334401838871229471503493680_Wanmei2017.aac,NSErrorFailingURLKey=https://s3-ap-northeast-1.amazonaws.com/zxmdata/thevoice/56334401838871229471503493680_Wanmei2017.aac , _kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey要求=-2102, NSLocalizedDescription=延时。}

4

1 回答 1

1

错误消息说这是一个NSErrorFailingURLStringKey错误。

错误消息中的 url 有错字,-https

h-ttps://s3-ap-northeast-1.amazonaws.com/zxmdata/thevoice/56334401838871229471503493680_Wanmei2017.aac

于 2017-08-14T09:25:41.067 回答