Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9105105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:01:14+00:00 2026-06-17T02:01:14+00:00

I am trying to use Amazon S3 SDK to upload a large file in

  • 0

I am trying to use Amazon S3 SDK to upload a large file in parts to S3 server. I have the following code:

-(void)multipartUpload:(NSData*)dataToUpload inBucket:(NSString*)bucket forKey:(NSString*)key
{
    //bool using3G = ![self isWifiAvailable];

    AmazonS3Client *s3 = [[AmazonS3Client alloc] initWithAccessKey:kS3ApplicationKey withSecretKey:kS3ApplicationSecret];

    s3.timeout = 99999999;

    @try {
        //[s3 createBucketWithName:bucket];

        S3InitiateMultipartUploadRequest *initReq = [[S3InitiateMultipartUploadRequest alloc] initWithKey:key inBucket:bucket];
        S3MultipartUpload *upload = [s3 initiateMultipartUpload:initReq].multipartUpload;
        S3CompleteMultipartUploadRequest *compReq = [[S3CompleteMultipartUploadRequest alloc] initWithMultipartUpload:upload];

        int numberOfParts = [self countParts:dataToUpload];


        for ( int part = 0; part < numberOfParts; part++ ) {
            NSLog(@"%d", part);

            NSData *dataForPart = [self getPart:part fromData:dataToUpload];

            // The S3UploadInputStream was deprecated after the release of iOS6.
            NSInputStream *stream = [NSInputStream inputStreamWithData:dataForPart];

            S3UploadPartRequest *upReq = [[S3UploadPartRequest alloc] initWithMultipartUpload:upload];
            upReq.partNumber = ( part + 1 );
            upReq.contentLength = [dataForPart length];
            upReq.stream = stream;
            upReq.delegate = self;

            S3UploadPartResponse *response = [s3 uploadPart:upReq]; // <----- null returned here :(
            [compReq addPartWithPartNumber:( part + 1 ) withETag:response.etag];
        }

        [s3 completeMultipartUpload:compReq];
    }
    @catch ( AmazonServiceException *exception ) {
        NSLog( @"Multipart Upload Failed, Reason: %@", exception  );
    }
    @catch (NSException *exception) {
        NSLog( @"Other exception %@", exception);
    }
}

The problem is that uploadPart method is returning null instead of actual server response which leads to an exception at the next line.

I have implemented all delegate methods to check for errors, but there is nothing reported.

The code is copied from here: http://aws.amazon.com/articles/0006282245644577

Any ideas why is it not working?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T02:01:15+00:00Added an answer on June 17, 2026 at 2:01 am

    The uploadPart method returns nil because you set the delegate property for the S3UploadPartRequest object. You need to retrieve response.etag in the request:didCompleteWithResponse: delegate method, or use the synchronous call without the delegate. The AWS Developer Blog explains how to properly use AmazonServiceRequestDelegate:
    http://mobile.awsblog.com/post/Tx2XVU3IRV1HBOJ/Using-the-AWS-SDK-for-iOS-Asynchronously-Part-I-Sync-vs-Async

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried to use Amazon-SDK(Java) sample code S3TransferProgressSample.java to upload large files to Amazon-S3
I am trying to use http://code.google.com/p/amazon-s3-php-class/ to force-dowload files from AWS S3. I have
I'm trying to understand amazon php sdk for AWS but I really can't use
I'm trying use mod_rewrite to rewrite URLs from the following: http://www.site.com/one-two-file.php to http://www.site.com/one/two/file.php The
Today is my second day of trying to use amazon and i have started
I am trying to use boto api to upload photos to Amazon S3. I
http://www.dscredstorm.com/getisbninfo.aspx I'm trying to use Amazon's api. I downloaded their example code, which is
I've migrated my server to amazon ec2, and trying to set up the following
I am trying to use Paperclip gem with Amazon S3 in my Rails 3.2
I'm trying to use Paperclip gem and store the documents on Amazon S3. In

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.