0

I would like to upload pictures, probably ranging from a few hundred to 1000, originally using AFNetwoking methods, but there is a drawback, it reads all image data one time, then memory is up,for example:

NSOperationQueue *operationQueue = [[NSOperationQueue alloc]init];
[operationQueue setMaxConcurrentOperationCount:1];

for (NSURL *fileURL in filesToUpload) {
      NSURLRequest *request = [[AFHTTPRequestSerializer serializer] multipartFormRequestWithMethod:@"POST"  
       URLString:@"http://example.com/upload" parameters:nil 
       constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
            [formData appendPartWithFileURL:fileURL name:@"images[]" error:nil];
       }];

       AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];

      [operationQueue addOperation:operation];
}

this will read all pictures's data before upload, how can i create a queue reduced memory consumption

Bobby
  • 44
  • 2
  • Create the new operations in batches or even one by one. – A-Live Jul 27 '15 at 12:02
  • You can use multipart to upload the images, check this [Link](http://stackoverflow.com/questions/15410689/iphone-upload-multipart-file-using-afnetworking). – Paddy Jul 27 '15 at 12:21
  • Similar question asked here [enter link description here][1] [1]: http://stackoverflow.com/questions/28716100/how-to-upload-images-using-afnetworking-directly-from-ipad-app – aman.sood Jul 27 '15 at 12:44

0 Answers0