6

'NSString' may not respond to the '-hexIntValue' warning, the function works wel...

 2 years ago
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.
neoserver,ios ssh client

'NSString' may not respond to the '-hexIntValue' warning, the function works well

advertisements

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'

In my iPhone app, I am making an access to the webserver to fetch the data. Here I am using JSON to retrieve the data from database. I get a warning that says: "NSString may not respond to '-JSONValue'" How to resolve it? Please Help & Sugge

NSString may not respond to add string

I have a NSMutableString and I am trying to use appendString method. Though it works fine but every time I use it, I receive a warning NSString may not respond to append string. This is my code : -(void)parser:(NSXMLParser *)parser foundCharacters:(N

objective-c The derived class may not respond to the base class method

I have derived from a 3rd party class, and when I attempt to call a method in the base class, I get the x may not respond to y compiler warning. How can I remove the warning? Repro: @interface ThirdPartyBaseClass : NSObject {} +(id)build; -(void)doSt

& ldquo; 'ViewController' may not respond to & hellip; & Rdquo; warning when I * declared * the method in @interface

I'm probably making a dumb mistake here, but I've been staring at my code and can't figure out what the problem is. I have a method defined in the @interface of my ViewController .h file as such: - (void) displaySubviewPopup:(PopupView *)currentPopup

My @property is declared but I still receive may not respond to the warning

I don't like warnings lying around and this one has been bothering me. Any ideas on what I am doing wrong? I have tons of properties using this same approach and none of them are giving me warnings. Why doesn't Xcode recognize this one? While the app

Get rid of & ldquo; 'NSObject' may not respond to '-someMethod' & rdquo; Warning

I'm learning ObjectiveC and ran into a problem relating to introspection. Basically, I'm looping through an array of objects and determining if they accept the lowercaseString selector. If they do, I call that selector on the object. After I ensure t

How to fix 'may not respond' for the selector introduced in the new SDK?

I have an application which builds against the 10.5 SDK. I still want it to behave correctly when running on 10.7 systems. The code snippet if ([window respondsToSelector:@selector(setRestorable:)]) { [window setRestorable:NO]; } however, triggers th

ViewController may not respond to the 'method' problem

I know it is a common problem, I googled a lot and seems get no luck to solve my problem. I have a @interface TestViewController:UIViewController and in its implementation file I have a method defined: -(void)method1 { do something; [self method1];//

The password is not visible in the entry (works well in chrome) not in firefox

I'm creating a drop down checkbox for password validation.I've changed the background for the input on focusing it.But,The password is not displayed in the black color discs in the input even after specifying styles for it.Codes: window.onclick = fun

Not your usual "Class" may not respond to the "method" warning - iPhone / Objective-C

I know that you must have already seen this warning and given the solution too often, but my case is a little bit special. I get the warning only for one class, but everything (imports, implementation, header-file, and so on) is set correctly. I'm co

iPhone: & ldquo; 'class_name' may not respond to methd_name & rdquo; and & ldquo; Unrecognized selector & rdquo; Errors

I have written an application in which I want to convert a .jpg image to .bmp format but I it fails with the error: class_name' may not respond to methd_name". My code is following : #import "CalculateRGBViewController.h" @implementation Ca

How to resolve the warning: 'NSArray' may not respond to '-objectForKey:'

warning: 'NSArray' may not respond to '-objectForKey:' PicsCount = [[[results objectForKey:@"wallper"] objectForKey:@"total"] intValue]; NSArray has no method 'objectForKey'. You may want an NSDictionary.

Error Xcode The semantic error value may not respond to 'initWithFrame: image Name:'

I am getting an error in my project. I have tried plenty of solutions but to no avail. I am getting an error Xcode Error Semantic error value may not respond to 'initWithFrame:image Name:' I have no idea what this means and why i'm getting this warni

Replacing a basic dataset: Warning: 'MyClass' may not respond to '-setPrimitiveName: newName:'

I'm overriding a Core Data setter with this code: - (void)setName:(NSString *)newName { [self willChangeValueForKey:@"name"]; [self setPrimitiveName:newName]; [self didChangeValueForKey:@"name"]; } It works perfectly, however I'm getti

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK