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 8826489
In Process

The Archive Base Latest Questions

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

as seen as ASIHTTP has been deprecated , for a new project i’m working

  • 0

as seen as ASIHTTP has been deprecated , for a new project i’m working on i’m trying to learn AFNetworking but i’m facing some problems i’m not able to solve.
i have the need to download many images from my website to save it locally. Unfortunately this images are not server standalone by the server but are incorporated into a plist that , with the image data returns to me some parameters

the php code that serves the image is this

$plist = new CFPropertyList();
$plist->add($maindict = new CFdictionary());
$maindict->add('foldername',new CFString($fol_name));
$file_ext = ($fol_name == "iPhoneRetina") ? "@2x.png" : ".png";
$file_path = "1";
$imgfile = __DIR__.'/documents/'.$file_path.'/'.$fol_name.'/doc_'.$file_path.'_pagina_'.$page_nr.$file_ext;
$imgbinary = fread(fopen($imgfile, "r"), filesize($imgfile));
$maindict->add('image',new CFData($imgbinary));
$maindict->add('page_nr',new CFNumber($page_nr));
$maindict->add('document_id',new CFNumber($doc_id));

to manage the request to this page of the server i’ve used this code

AFHTTPClient *client = [[AFHTTPClient alloc] initWithBaseURL:downloadURL];
    NSDictionary *params;
    AFHTTPRequestOperation *operation;
    for (int x = 0; x < 10; x++) {
        params = @{
            @"page_nr" : [NSNumber numberWithInt:x],
            @"doc_id" : @1,
        };
        NSMutableURLRequest *request = [client requestWithMethod:@"POST" path:@"/getMagazinePage.php" parameters:params];
        operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
        [tempOperations addObject:operation];
    }
    [client enqueueBatchOfHTTPRequestOperations:tempOperations
                                  progressBlock:^(NSUInteger numberOfCompletedOperations, NSUInteger totalNumberOfOperations) {
                                      dispatch_async(dispatch_get_main_queue(), ^{
                                          [cell setDownloadProgress:(float)numberOfCompletedOperations/(float)totalNumberOfOperations];
                                      });

                                  } completionBlock:^(NSArray *operations) {
                                      [cell setDownloaded:YES];
/*                                      for (AFHTTPRequestOperation *ro in operations) {

                                          if (ro.error) {

                                              NSLog(@"++++++++++++++ Operation error");

                                          }else {
                                              //NSLog(@"Operation OK: %@", [ro.responseData description]);
                                          }
                                      }*/

                                  }];

But i’m not able to save the image during the progress block ( as because i have no other parameters to the block ) and iterate trough the operation array may be a little memory consuming, in case images are really heavy or there are a lot of pages.
i’ve read that someone suggest to use the

operation.outputStream = [NSOutputStream outputStreamToFileAtPath:@"download.zip" append:NO];

but in this case i have no direct stream of the image but a value contained in an plist.
Does anyone faced with this problem and how solved it ?

  • 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-14T07:09:02+00:00Added an answer on June 14, 2026 at 7:09 am

    You can set completionBlock on each of the operations to do whatever you need, whether that’s saving the responseData somewhere, or what have you.

    Note that there is no guarantee that the completion blocks for all operations will be finished by the time that the batch completes, so don’t depend on that in the batch completion block.

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

Sidebar

Related Questions

As seen here and some other places for each is well explained, but how
Have seen some conversations revolving around this, but hoping for some current input as
ive seen some pages that offer new ajax animations.. can i use those in
Seen some references, but its old Rails 2 solutions. Having a hard enough time
I`ve seen some information here but it looks kind of not audible for me.
Have seen some similar questions: What is the difference between a JavaBean and a
Having seen the advantages of metaprogramming in Ruby and Python, but being bound to
I've seen another reference to this but I can't understand the response. I am
I have seen some people in SO commenting that Singleton Pattern is an anti-pattern.
Never seen this before in ASP.NET development. I'm trying to refactor out 40 single-page

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.