2014-11-15 70 views
1

所以我有一個NSFetchedResultsController。我有正常顯示數據的工作正常。我有一種情況需要通過他們來激勵。所以我取結果在這裏看到:快速枚舉NSFetchedResult

if (![[self fetchedResultsController] performFetch:&error]) { 

     exit(-1); // Fail 
    } 

我需要對數據進行處理一些工作之前,我顯示出來,所以我將其分配給一個數組是這樣的:

arrVacationResults = [fetchedResultsController fetchedObjects]; 

完美的作品等等遠。我現在有一個fetchedObjects數組。我試圖使用快速枚舉,但我如何引用每個數組中的whats。我以爲這是那種一本字典,所以我試圖做類似

for (NSDictionary *myVacation in arrVacationResults) 
{ 

} 

,由於在arrVacationResults他們不是NSDictionaries失敗,是他們那又怎麼樣呢?

+0

僅供參考 - 我希望你真的沒有在你的代碼爲'exit'通話。爲什麼不記錄錯誤並妥善處理問題? – rmaddy

+0

它在我的「待辦事項列表」上。感謝提醒@rmaddy! – logixologist

回答

1

這是NSManagedObjects的數組:

for (NSManagedObject *myVacation in arraVacationResults) 
{ 
// 
// if you need to cast it as your entity 
// 
    VacationResultEntity *entity = (VacationResultEntity *) myVacation; 
}