【问题标题】:Video upload on Amazon S3 in iphone applicationiphone应用程序中Amazon S3上的视频上传
【发布时间】:2013-12-31 04:48:52
【问题描述】:

我正在从 iphone 应用程序将视频上​​传到 Amazon S3。早些时候它上传正常,但现在它突然停止上传视频并使应用程序崩溃。下面是视频上传的代码

    if(![ACCESS_KEY_ID isEqualToString:@"CHANGE ME"]
       && self.s3 == nil)
    {
        // Initial the S3 Client.
        self.s3 = [[[AmazonS3Client alloc] initWithAccessKey:ACCESS_KEY_ID withSecretKey:SECRET_KEY] autorelease];
        self.s3.endpoint = [AmazonEndpoints s3Endpoint:US_WEST_2];

    }


   NSString *videoName =[NSString stringWithFormat:@"%@",titleTextField.text];
   NSString *trimmedString = [videoName stringByTrimmingCharactersInSet:
                           [NSCharacterSet whitespaceCharacterSet]];
   NSLog(@"name %@",trimmedString);

   S3PutObjectRequest *por = [[[S3PutObjectRequest alloc] initWithKey:trimmedString
                                                          inBucket:[Constants pictureBucket]] autorelease];



por.contentType = @"movie/mp4";


por.data= videoData;


S3PutObjectResponse *putObjectResponse = [self.s3 putObject:por];

这是崩溃日志

终止由于被und被终止的应用程序,原因是:'(null)'*第一次投掷呼叫堆栈:( 0x2F370F53 0x399db6af 0xb6af 0xb6119 0xc39b3 0xc2f4d 0x533b9 0x5333b9 0x53366f2222222536f536ff4b9 abl indb9 abl ind x536ff40 ab96f5366ff4b9 ab。 .dylib:以 AmazonServiceException 类型的未捕获异常终止

【问题讨论】:

  • 似乎一切都很好,尝试调试,然后提供我们的崩溃堆栈,希望我们可以帮助您。
  • 您能否编辑您的问题并将崩溃日志放在问题本身中。
  • @mAc 在编辑中添加了崩溃日志
  • 这不是整个崩溃日志:(,这是您遇到的异常。仔细查看异常,可以确定您在返回某个对象时获得了 null。尝试调试对象的位置您的检索结果为空。

标签: ios video amazon-s3


【解决方案1】:

尝试设置内容长度字段并在本地声明 S3 客户端:

AmazonS3Client *s3 = [[AmazonS3Client alloc] initWithAccessKey:ACCESS_KEY_ID withSecretKey:SECRET_KEY]; //auto release deprecated, and not necessary with local declaration
s3.endpoint = [AmazonEndpoints s3Endpoint:US_WEST_2];

//post full video
por = [[S3PutObjectRequest alloc] initWithKey:generatedString inBucket:@"dormpicbucket"];
por.contentType = @"video/mp4";
por.data = capturedMovie;
por.delegate = self;
[por setDelegate:self];
por.contentLength = [capturedMovie length];
[s3 putObject:por];

还要确保调试:[Constants pictureBucket],因为看起来您几乎明确地使用了来自 aws 文档的示例/教程代码,哈哈。

【讨论】:

    猜你喜欢
    • 2012-02-11
    • 2010-11-06
    • 2012-06-03
    • 2013-05-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-17
    • 2023-03-18
    相关资源
    最近更新 更多