Open tanvic06 opened 9 years ago
The error indicates it thinks you are trying to compare with a column called isRemoved.boolValue. Obviously, no such column exists because that is not what you are trying to tell it compare with. Try removing .boolValue and see if it works.
Thanks @jasper-ch-chan for the help.
I have tried using your suggestion and found that the predicate works fine when applied to a FetchedResultsController (return type of method is NSFetchedResultsController) but returns nil for methods having return type as NSArray.
@tanvic06 That sounds very odd as it should be irrelevant. FRC uses NSFetchRequest to perform the fetch; however I've never used NSExpression. Perhaps you can try using just a simple NSFetchRequest to see if it works to try to pin point the problem?
@jasper-ch-chan as mentioned earlier, NSExpression applied to NSFetchRequest is definitely working fine but not when applied to NSArray. Thanks for the help though!
Hi,
I have a column with BOOL value and a NSPredicate on that column as : NSPredicate* predicate2 = [NSComparisonPredicate predicateWithLeftExpression:[NSExpression expressionForKeyPath:@"isRemoved.boolValue"] rightExpression:[NSExpression expressionForConstantValue:[NSNumber numberWithBool:NO]] modifier:NSDirectPredicateModifier type:NSEqualToPredicateOperatorType options:0];
App crashes with error : Unresolved error Error Domain=NSSQLiteErrorDomain Code=1 "The operation couldn’t be completed. (NSSQLiteErrorDomain error 1.)" UserInfo=0x7b7b2530 {EncryptedStoreErrorMessage=no such column: isRemoved.boolValue}, { EncryptedStoreErrorMessage = "no such column: isRemoved.boolValue"; }
Any suggestions on how do I compare BOOL value in NSExpression?