Shriram Kadam Shriram Kadam - 1 year ago 272
Objective-C Question

Equality comparison result unused in iOS 9

I just moved to iOS 9 and noticed some new warnings on my old code:

description.becomeFirstResponder == YES;

Display warning 'Equality comparison result unused'

How can I handle this Warning.

Thank You!

Answer Source

You probably meant to assign, as in:

description.becomeFirstResponder = YES;

(== is the equality comparison operator).

The compiler is complaining as the result of the comparison wasn't being used, as it would be in:

if (description.becomeFirstResponder == YES) { /* do something */ }
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download