パート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 問題を準備しました
以下はエラーログです:
content-encoding:aws-chunked content-type:binary/octet-stream host:s3-ap-northeast-1.amazonaws.com transfer-encoding:Chunked user-agent: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=content-encoding;content-type;host;transfer-encoding;user-agent;x-amz-content-sha256;x-amz-date;x-amz-decoded-content-length, Signature=f91f3f9002bfe3ae7ec39c71846efd7c99bdf72d5f8163ac400d476f1055b7e7"; " Content-Encoding" = "aws-chunked"; "Content-Type" = "binary/octet-stream"; Host = "s3-ap-northeast-1.amazonaws.com"; "Transfer-Encoding" = Chunked; "ユーザーエージェント" = "aws-sdk-iOS/2.5.9 iOS/10.2.1 zh_CN transfer-manager"; "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] セッション タスクが次のエラーで失敗しました: エラー Domain=NSURLErrorDomain Code=-1001 "要逾時。" UserInfo={NSUnderlyingError=0x171056e90 {Error Domain=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/5633440183887122440183.0anmei_93680 } 2017-08-13 22:31:11.161499 test[1026:597374] エラー: エラー Domain=NSURLErrorDomain Code=-1001 "要時。" UserInfo= {NSUnderlyingError=0x171056e90 {エラー ドメイン=kCFErrorDomainCFNetwork コード=-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=要求時。}