2014-03-04 98 views
1

我想通過deleted = NO過濾NSManagedObjects的數組,這個過濾不起作用。 deleted字段有一個默認值,所以零應該不是一個問題。使用NSPredicate通過布爾值屬性過濾NSManagedObjects

+0

可能重複[Core Data NSPredicate predicateWithBlock和predicateWithFormat in Parent Child Context](http://stackoverflow.com/questions/16000242/core-data-nspredicate-predicatewithblock-and -predicatewithformat-in-parent-child) –

回答

0

比較你BOOLNSPredicate這種方式應該工作:

[NSPredicate predicateWithFormat:@"deleted == %@", [NSNumber numberWithBool: NO]]; 
+0

只要格式字符串使用'%d',在謂詞中使用普通的'BOOL'即可。 –