Hi I have a NSArray (playersList) containing the following NSManagedObjects :
(
"<NSManagedObject: 0x6b75980> (entity: Players; id: 0x6b749d0 <x-coredata://463316AB-BCF5-4257-AE5B-26E3AAB0DAE1/Players/p1> ; data: { \"id_player\" = 2;\n name = 7777;\n})",
"<NSManagedObject: 0x6b759e0> (entity: Players; id: 0x6b749e0 <x-coredata://463316AB-BCF5-4257-AE5B-26E3AAB0DAE1/Players/p2> ; data: { \"id_player\" = 3;\n name = \"hcp 5\";\n})",
"<NSManagedObject: 0x6b756d0> (entity: Players; id: 0x6b749c0 <x-coredata://463316AB-BCF5-4257-AE5B-26E3AAB0DAE1/Players/p3> ; data: {\"id_player\" = 4;\n name = 1;\n})"
)
How can I query it to return the object with ‘id_player==3’?
There are several ways to do it.
iterate the array and just check the id_player property of each object in the array
use a predicate (see the predicate programming guide for details)