Shriram Kadam Shriram Kadam - 5 months ago 28
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

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 */ }
Comments