title: core data fetch data order by id
body: <p>I'm trying to get allways the same order for my fetch data, because all the time I request, he get another sorted array so I'm trying to order by ID but I couldn't.</p>
  
  <p>My situation:
  I have 2 models, FORM and FORMCOMPONENT
  1 FORM have many FORMCOMPONENT
  when I do this:</p>
  
  <pre><code>Form *form = ...;
  [form formComponents]; //I get all the components but each time I run I get with a differente order
  </code></pre>
  
  <p>How I suppose order this if I don't have any field for ORDER? On android I did this with the ID.. that's why I don't have any field with this proposal.</p>
  
  <p>I tryed to order in a array with sortWithComparator but I can't do this because I'm not allowed to get the number ID (only the number, not the entire string he give me with [obj objectID] ). This is funny because when I use sqlite3 for see the database only have the number there.</p>
  
  <p>Another way I thought about is get the FORMCOMPONENTs direct with a new request, not by FORM one ([form formComponents]), like this:</p>
  
  <p>AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];</p>
  
  <pre><code>NSEntityDescription *entity = [NSEntityDescription entityForName:@"FormComponent" inManagedObjectContext:[appDelegate managedObjectContext]];
  NSFetchRequest *request = [[NSFetchRequest alloc] init];
  [request setEntity:entity];
  //SOME PREDICATE WITH THE FORM
  [request setPredicate:predicate];
  NSError *error = nil;
  NSMutableArray *arrayComps = (NSMutableArray*) [[appDelegate managedObjectContext] executeFetchRequest:request error:&amp;error];
  </code></pre>
  
  <p>so, anyone have an idea? Thanks.</p>
  
  <p>--- EDIT ---</p>
  
  <p>PS: I don't want to avoid the problem creating another field for order. If I don't have any other solution so I will do this.</p>