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

  • Home
  • SEARCH
  • 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 8598691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:12:52+00:00 2026-06-12T01:12:52+00:00

I am using AFNetworking to download large file into my iPad app. An instance

  • 0

I am using AFNetworking to download large file into my iPad app.

An instance of AFHTTPRequestOperation is used to download this file. Below is the code for reference –

//request is the NSRequest object for the file getting downloaded
AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request
                                        success:^(AFHTTPRequestOperation *operation, id responseObject) {                                                                        

                                        } failure:^(AFHTTPRequestOperation *operation, NSError *error) {


                                        }];
//here path variable is the location where file would be placed on download
operation.outputStream = [NSOutputStream outputStreamToFileAtPath:path
                                                               append:YES];
//since this class is subclass of AFHTTPClient so the operation is added to request queue
[self enqueueHTTPRequestOperation:operation];

Now the issue here is that when i try pause and resume this download using below functions, the pauseDownload function works properly however the resume download doesn’t work the way it should and it seems like the download starts from the beginning where as I was expecting that it will resume from the place it left. What could be an issue here?

-(void)pauseDownload{
    [operation pause];
}

-(void)resumeDownload{
   [operation resume];
}
  • 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-12T01:12:54+00:00Added an answer on June 12, 2026 at 1:12 am

    After spending sometime I figured out how to pause and resume the download.

    AFNetworking has extensions one of them is AFDownloadRequestOperation which is essentially used to handle the pause and resume of large files. So instead of using AFHTTPRequestOperation here AFDownloadRequestOperation is to be used. Below is sample code

    //request is the NSRequest object for the file getting downloaded and targetPath is the final location of file once its downloaded. Don't forget to set shouldResume to YES
    AFDownloadRequestOperation *operation = [[AFDownloadRequestOperation alloc] initWithRequest:request
                                                                                         targetPath:targetPath
                                                                                       shouldResume:YES];
    [operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
        //handel completion
        }failure:^(AFHTTPRequestOperation *operation, NSError *error) {
         //handel failure
     }];
    [operation setProgressiveDownloadProgressBlock:^(NSInteger bytesRead, long long totalBytesRead, long long totalBytesExpected, long long totalBytesReadForFile, long long totalBytesExpectedToReadForFile) {
        //handel progress
    
    }];
    //since this class is subclass of AFHTTPClient so the operation is added to request queue
    [self enqueueHTTPRequestOperation:operation];
    
    //used to pause the download
    -(void)pauseDownload{
        [operation pause];
    }
    //used to resume download
    -(void)resumeDownload{
       [operation resume];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using AFNetworking with AFHTTPRequestOperation to pull XML data from a webservice. This is
I wrote two code both are same Using NSURLConnection and Using AFNetworking. My NSURLConnection
I am trying to log into google reader using AfNetworking AfHttpClient but I am
I've encountered a problem using AFNetworking to download files from a Rackspace repository. Basically
We're using AFNetworking in our mobile app and a lot of times we will
Using AFNetworking, I need to download ~100 images in the background and store them
I'm already using AFNetworking for async image download. I was wondering if there's a
I am doing an authentication by using AFNetworking like below AFJSONRequestOperation *operation = [AFJSONRequestOperation
I'm using the AFNetworking framework to download files and write them to the local
I am using AFNetworking in an app I am developing. For downloading requests, I

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.