we start having warning on becomefirstresponder function call in our objective-c code.
ignoring return value of function declared "warn_unused_result" attribute
[self.phonenumberfield becomefirstresponder]; // warning here!!! what's best way suppress warning here?
edit: tried this,
bool ignore = [self.emailfield becomefirstresponder]; but that, xcode has warning variable ignore not used :(
i tried this,
bool ignore = [self.phonenumberfield becomefirstresponder]; if (ignore) { } the warnings gone in case. don't think can past own code review. ugly!
it should work cast expression void expression.
(void)[self.emailfield becomefirstresponder]; (even cannot reproduce warning. however, might depend on warning flags.)
to edit:
bool ignore = [self.emailfield becomefirstresponder]; likely
bool ignore = [self.emailfield becomefirstresponder]; ignore = ignore; // or (void)ignore; should remove warning. (it flags.) however, ugly hack, too.
btw: there reason attribute. maybe should recheck, whether idea, not test return value.
Comments
Post a Comment