【问题标题】:AFNetworking / AFAmazonS3Client Amazon file uploadingAFNetworking / AFAmazonS3Client 亚马逊文件上传
【发布时间】:2014-04-20 16:45:49
【问题描述】:

我在尝试使用 AFNetworking / AFAmazonS3Client 将文件上传到亚马逊时收到以下错误

s3Client = [[AFAmazonS3Client alloc] initWithAccessKeyID:@"mykey" secret:@"mysecretkey"];
s3Client.bucket = @"media.mysite.com";

[s3Client postObjectWithFile:video.assetPath destinationPath:@"/media/videos/" parameters:nil progress:

 ^(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite){

     DLog(@"%f%% Uploaded", (totalBytesWritten / (totalBytesExpectedToWrite * 1.0f) * 100));
 }

                     success:^(id responseobject){

                         DLog(@"Success");
                         [self deleteAsset:video];

                     }failure:^(NSError* error){

                          DLog(@"Failed %@", error);
                         [self updateVideoAsset:video.assetID key:@"uploadStatus" value:[NSNumber numberWithInt:ESUploadNotStarted]];
                     }];

此服务器的证书无效。您可能正在连接到伪装成“media.myserver.com.s3.amazonaws.com”的服务器,这可能会使您的机密信息面临风险

如何解决这个问题

谢谢 东姑

【问题讨论】:

    标签: iphone ios afnetworking


    【解决方案1】:

    AWS SDK for iOS(旧版本)中似乎存在一些可能导致此问题的问题:https://forums.aws.amazon.com/message.jspa?messageID=248288

    【讨论】:

      【解决方案2】:

      以防其他人偶然发现:使用不带句点的存储桶名称(例如 media-mysite-com)。这样一来,Amazon 的通配符 SSL 证书仍然适用,您将避免该错误。

      参见例如How to Configure SSL for Amazon S3 bucket

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-03-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-02-23
        • 2017-07-11
        相关资源
        最近更新 更多