2013-01-02 94 views
0

我正在嘗試爲核心數據中的數據編寫一個提取例程。我設法獲取數據庫中的所有數據並在表格視圖中顯示,但是,如何僅基於查詢獲取部分數據?從核心數據中提取

例如,在SQL:

Select * from DB where name = 'bob'; 

回答

0

你要使用NSPredicate了點。東西沿着這些線

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(name == %@)", name]; 
[fetchRequest setPredicate:predicate]; 
+0

這很好 - 我會給它一個去。太感謝了。 – RGriffiths