title: good solution to store a specific list of values?
body: <p>I use following code to retrive the upload order of files. The files must be uploaded in this specific order and cannot be uploaded simultaneously. Therefor I cannot put my code in this for-loop because it would hang the thread. </p>
  
  <pre><code>    NSSortDescriptor *sort = [NSSortDescriptor sortDescriptorWithKey:@"order" ascending:YES];
  NSArray *sortedArray = [agenciescontroller.arrangedObjects sortedArrayUsingDescriptors:[NSArray arrayWithObject:sort]];
  
  for (NSManagedObject *a in sortedArray)
  {
      for (NSMutableDictionary *d in imagescontroller.arrangedObjects)
      {
          if ([[NSString stringWithFormat:@"%@",[d valueForKey:[a valueForKey:@"agency"]]] isEqualToString: @"1"])
          {
  
              ///////////////////////////UPLOAD FILES HERE/////////////////////////////
              checkedchecks += 1;
              NSLog(@"Uploading %@ to %@", [d valueForKey:@"filename"], [a valueForKey:@"agency"]);
          }
      }
  }
  </code></pre>
  
  <p>My idea was to use this for loop to populate a <code>NSMutableArray</code> or <code>NSMutableDictionaries</code> holding the precise list of files to upload and then go trough this list one by one. Is this a wise idea or is there a better solution? Also keep in mind that once the file is uploaded, I have to update a value inside the mutable dictionary in the foor loop. Where I check for a value = "1" that specific value has to be set to 0 once the upload is finished.</p>