第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-分块 内容类型:二进制/八位字节流 主持人:s3-ap-northeast-1.amazonaws.com 传输编码:分块 user-agent:aws-sdk-iOS / 2.5.9 iOS / 10.2.1 zh_CN transfer-manager 的x AMZ-内容-SHA256:STREAMING-AWS4-HMAC-SHA256-PAYLOAD X-AMZ-日期:20170813T133010Z 的x AMZ解码-内容长度: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-内容-SHA256; X-AMZ-日期; X-AMZ解码-内容长度, 签名= f91f3f9002bfe3ae7ec39c71846efd7c99bdf72d5f8163ac400d476f1055b7e7" ; “Content-Encoding”=“aws-chunked”; “Content-Type”=“binary / octet-stream”; 主持人=“s3-ap-northeast-1.amazonaws.com”; “Transfer-Encoding”= Chunked; “User-Agent”=“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-decoding-content-length”= 78670; } 2017-08-13 22:31:11:117 test [1026:597507]会话任务失败并显示错误:Error Domain = NSURLErrorDomain Code = -1001“要求逾时。” UserInfo = {NSUnderlyingError = 0x171056e90 {错误 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/56334401838871229471503493680_Wanmei2017.aac, _kCFStreamErrorDomainKey = 4,_kCFStreamErrorCodeKey = -2102,NSLocalizedDescription =要求逾时。} 2017-08-13 22:31:11.161499 test [1026:597374]错误:错误Domain = NSURLErrorDomain Code = -1001“要求逾时。” UserInfo = {NSUnderlyingError = 0x171056e90 {错误 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/56334401838871229471503493680_Wanmei2017.aac, _kCFStreamErrorDomainKey = 4,_kCFStreamErrorCodeKey = -2102,NSLocalizedDescription =要求逾时。}
答案 0 :(得分:1)
错误消息表明它是NSErrorFailingURLStringKey错误。
错误消息中的网址在https
中有错误h-ttps://s3-ap-northeast-1.amazonaws.com/zxmdata/thevoice/56334401838871229471503493680_Wanmei2017.aac
:
UIPopoverPresentationController