我有一個情況,我有一個ObjectA
的列表。 ObjectA
與ObjectB
有多對多的關係。我需要遍歷ObjectA
的列表並存儲ObjectB
引用的所有名稱。通過CoreData ManagedObject的關係循環
我目前做這點實際的for循環的方式爲使用執行時間儀器的89.5%:
for (ObjectA *a in listA) {
[names removeAllObjects];
for (ObjectB *b in a.objectBs) { //This is 89.5% of the execution time
[names addObject:b.name];
}
}
有什麼辦法來處理這更好的?