篩選我有一個表視圖,用戶可以添加的東西,它會被保存在覈心數據。他們添加諸如魚,豬肉,麩質或任何他們過敏的成分。每當他們將這些數據添加到表格視圖時,我都會保存這些數據。然後,當他們進入不同的頁面時,我試圖訪問具有數據的THAT數組。我取數據,像這樣:如何通過核心數據代碼
NSManagedObjectContext *managedObjectContext = [self managedObjectContext];
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] initWithEntityName:@"AllergicIngredient"];
matchAgainstArray = [[managedObjectContext executeFetchRequest:fetchRequest error:nil] mutableCopy];
當我的NSLog 「matchAgainstArray」,控制檯返回此:
"<AllergicIngredient: 0x1667c5f0> (entity: AllergicIngredient; id: 0x1667c3a0 <x-coredata://3845687F-8AAC-48FF-BB0F-8026A7771A3E/AllergicIngredient/p1> ; data: <fault>)",
"<AllergicIngredient: 0x1667ca50> (entity: AllergicIngredient; id: 0x1667c3b0 <x-coredata://3845687F-8AAC-48FF-BB0F-8026A7771A3E/AllergicIngredient/p2> ; data: <fault>)",
"<AllergicIngredient: 0x1667ca90> (entity: AllergicIngredient; id: 0x1667c3c0 <x-coredata://3845687F-8AAC-48FF-BB0F-8026A7771A3E/AllergicIngredient/p3> ; data: <fault>)",
"<AllergicIngredient: 0x1667cae0> (entity: AllergicIngredient; id: 0x1667c3d0 <x-coredata://3845687F-8AAC-48FF-BB0F-8026A7771A3E/AllergicIngredient/p4> ; data: <fault>)",
"<AllergicIngredient: 0x1667cb20> (entity: AllergicIngredient; id: 0x1667c3e0 <x-coredata://3845687F-8AAC-48FF-BB0F-8026A7771A3E/AllergicIngredient/p5> ; data: <fault>)"
)
和核心數據是正確的我救了5個項目,但我想要項目的名稱,而不是這些混亂的數據。
所以我的問題是,我該怎麼通過這個過濾得到的名字?