Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NSPredicate predicateWithFormat:] does not correctly match if rhs bool value is defined in format string. #541

Closed
rupertdaniel opened this issue Jun 9, 2016 · 2 comments
Assignees

Comments

@rupertdaniel
Copy link

NSPredicate does not match a bool property if the rhs value is specified in the format string. However if the rhs value is supplied as a param it does work as expected.

For example:

TestObjectB *b = [[TestObjectB alloc] init];
b.flag = YES;

[[NSPredicate predicateWithFormat:@"flag == YES"] evaluateWithObject:b] // Will be false
[[NSPredicate predicateWithFormat:@"flag == %d", YES] evaluateWithObject:d] // Will be true

Another twist is that if you match against a NSDictionary object it works as expected:

NSDictionary *d = @{@"flag" : @(YES)};

[[NSPredicate predicateWithFormat:@"flag == YES"] evaluateWithObject:d]) // Will be true
@msft-Jeyaram msft-Jeyaram self-assigned this Jun 9, 2016
@msft-Jeyaram
Copy link
Contributor

@rupertdaniel thank you for filing the issue.
The root cause has been tracked down and it turns out to be, the changes we made to NSNumber isEqual in the new CoreFoundation.

@ArnOmsft
Copy link
Member

This was part of our release on June 21. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants