views:

34

answers:

0

I'm finding that a NSFetchRequest is returning different results for a count and for an execute.

I have a Product entity and a Size entity. A Product has many Sizes.

I have two products, productA and productB. ProductA is only available in size1 and productB is available in both size1 and size2.

Given the NSPredicate

'ANY sizes.#size IN {"size1", "size2"}'

I'm finding that it returns 3 for the countForfetchRequest but an array of 2 items when I execute the fetch request.

The count is the value that is incorrect. ProductB has both sizes and seems to be being counted twice in the countForfetchRequest but obviously only returned once by the executeFetchRequest call.

I've tried setting setReturnsDistinctResults:YES with no effect.