'NSString' may not respond to the '-hexIntValue' warning, the function works wel...
source link: https://www.codesd.com/item/nsstring-may-not-respond-to-the-hexintvalue-warning-the-function-works-well.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
'NSString' may not respond to the '-hexIntValue' warning, the function works well
I'm taking a hex color value received as a string and converting it to an int so that I can get the proper hex values. I have the following code underneath my imports:
@implementation NSString (HexIntValue)
- (unsigned int)hexIntValue
{
NSScanner *scanner;
unsigned int result;
scanner = [NSScanner scannerWithString: self];
[scanner scanHexInt: &result];
return result;
}
@end
and then the function is called on a string here:
unsigned int x = (int)[globalBGColor hexIntValue];
Everything works fine, but I really want to get rid of the warning because I'm more or less prepared to submit my app.
Thanks!
I would toss your category in another file. The convention would be to name it "NSSting+HexIntValue.h". Then make sure you #import it. Should clear everything up.
Related Articles
iPhone: Warning: NSString May Not Respond to '-JSONValue'
NSString may not respond to add string
objective-c The derived class may not respond to the base class method
& ldquo; 'ViewController' may not respond to & hellip; & Rdquo; warning when I * declared * the method in @interface
My @property is declared but I still receive may not respond to the warning
Get rid of & ldquo; 'NSObject' may not respond to '-someMethod' & rdquo; Warning
How to fix 'may not respond' for the selector introduced in the new SDK?
ViewController may not respond to the 'method' problem
The password is not visible in the entry (works well in chrome) not in firefox
Not your usual "Class" may not respond to the "method" warning - iPhone / Objective-C
iPhone: & ldquo; 'class_name' may not respond to methd_name & rdquo; and & ldquo; Unrecognized selector & rdquo; Errors
How to resolve the warning: 'NSArray' may not respond to '-objectForKey:'
Error Xcode The semantic error value may not respond to 'initWithFrame: image Name:'
Replacing a basic dataset: Warning: 'MyClass' may not respond to '-setPrimitiveName: newName:'
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK