D
D
Dmitry2015-11-02 14:55:32
Objective-C
Dmitry, 2015-11-02 14:55:32

Is it possible to filter the selection from Core Data from duplicates using NSPredicate?

Core Data contains objects one of whose attributes is not unique.
For example:
object1.color = red;
object2.color = green;
object3.color=blue;
object4.color=green;
object5.color=red;
object5.color=pink;
I want to compose an NSPredicate in an NSFetchedResultsController so that it returns a list of colors to me. It is important that the colors do not repeat.
What I want to get:
Colors:
Red
Green
Blue
Pink
Is it possible to do this with NSPredicate? If not, how can I arrange this in NSFetchedResultsController?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
deleted-mezhevikin, 2015-11-03
@koyard

Try [request setReturnsDistinctResults:YES];
stackoverflow.com/questions/16424720/nspredicate-f...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question