title: core data Group By fetch all propetries issues
body: <p>I have a single table</p>
  
  <pre><code>DB_SMS 
  ----------------------------------------
  contactId | messageText | to | createdAt
  </code></pre>
  
  <p>I want fetch the most recently created record for each contactId.  For example:</p>
  
  <pre><code>contactId | messageText | to | createdAt
          1 |       msg01 |  a | 2015-04-20
          1 |       msg02 |  b | 2015-04-21
          2 |       msg03 |  c | 2015-04-20
          3 |       msg04 |  d | 2015-04-20
          3 |       msg05 |  w | 2015-04-22
  </code></pre>
  
  <p>Required result</p>
  
  <pre><code>contactId | messageText | to | createdAt
          1 |       msg02 |  b | 2015-04-21
          2 |       msg03 |  c | 2015-04-20
          3 |       msg05 |  w | 2015-04-22
  </code></pre>
  
  <p>I am using following code </p>
  
  <pre><code>NSFetchRequest * theRequest = [NSFetchRequest fetchRequestWithEntityName:@"DB_SMS"];
  
  [theRequest setResultType:NSDictionaryResultType];
  
  [theRequest setPropertiesToFetch:@[@"contactId",@"messageText",@"to",@"createdAt"]];
  
  [theRequest setPropertiesToGroupBy:@[@"contactId"]];
  
  [theRequest setSortDescriptors:@[[NSSortDescriptor sortDescriptorWithKey:@"createdAt" ascending:NO]]];
  
  NSArray * theArray = [theDbHandler.managedObjectContext executeFetchRequest:theRequest error:nil];
  </code></pre>
  
  <p>i'm getting following exception</p>
  
  <pre><code>SELECT clauses in queries with GROUP BY components can only contain properties named in the GROUP BY or aggregate functions 
  </code></pre>
  
  <p>plz suggest some solution .</p>