I am currently having an issue pulling all data from db whereby i.e 1 parameter is TRUE.
I am using NSPredicate
and below is a sample code
NSManagedObjectContext *context = managedObjectContext_;
if (!context) {
// Handle the error.
NSLog(@"ERROR CONTEXT IS NIL");
}
NSEntityDescription *entity = [NSEntityDescription entityForName:@"tblcontent" inManagedObjectContext:managedObjectContext_];
NSFetchRequest *request = [[NSFetchRequest alloc] init];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"bookmarked == YES"];
[request setPredicate:predicate];
I tried setting predicatewithformat to almost everything but it still does not pull out bookmarks which have a YES
value.
I even tried (@"bookmarked == %d",YES)
but with not luck. I don't want to have to get the whole array and then filter it manually by doing if(object.bookmarked == YES)
.....blabla.
I will really appreciate some help.
Many thanks.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…