Aly
Aly

Reputation: 391

NSDictionaryResultType vs NSManagedObjectResultType

I am working on fetching the distinct data and I set resulttype to NSDictionaryResultType and it will return 10 distincts data which is good, but I want that data to be in NSManagedObjectResultType.

  [fetch setPropertiesToFetch:[NSArray arrayWithObjects:pageid, pagename,  nil]];
  [fetch setReturnsDistinctResults : YES];
  [fetch setResultType:NSDictionaryResultType];

I also used NSManagedObjectResultType, but it does not return the distinct data and it returns 30 records.

Upvotes: 1

Views: 347

Answers (1)

Tom
Tom

Reputation: 118

Property returnsDistinctResults only for NSDictionaryResultType here is the API Description

Returns/sets if the fetch request returns only distinct values for the fields specified by propertiesToFetch. This value is only used for NSDictionaryResultType. Defaults to NO.

Upvotes: 1

Related Questions