NSFetchRequest invalid error

I'm using the following code to find out how many unique names I have. It's giving an exception saying "Invalid fetch request: GROUP BY requires NSDictionaryResultType". But, I'm clearly specifying that type. Is there another property that's required here?



var request = NSFetchRequest(entityName: "Player")
request.resultType = .DictionaryResultType
request.predicate = NSPredicate(format: "bye = 0 AND (ANY %K == %@ OR ANY %K == %@)", "matches.bracket", self, "matches2.bracket", self)
request.propertiesToFetch = ["name"]
request.propertiesToGroupBy = ["name"]
     
let count = self.managedObjectContext!.countForFetchRequest(request, error: nil)


If I just change that to be a normal executeFetchRequest I get back the expected 5 groups.

NSFetchRequest invalid error
 
 
Q