NinjaLikesCheez NinjaLikesCheez - 7 months ago 61
iOS Question

-[__NSCFNumber isEqualToString] error

I'm getting this crash, but, in my code I am using a string. I've been working on this one piece of code for 2 hours now and I just can't see what I'm missing! Any ideas?

NSString *codeR = [NSString stringWithFormat:@"%@", [[object objectForKey:@"code"] stringValue]];

if([codeR isEqualToString:@"200"])


Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber isEqualToString:]: unrecognized selector sent to instance 0x181cf0'

I would be very grateful input, this is confusing the hell out of me!



Get rid of silly redundancy, see what happens.

NSString *codeR = [[object objectForKey:@"code"] stringValue];
// mysterious missing code
if ([coreR isEqualToString:@"200"]) // etc

Also, are you sure the error is raised from the if statement you posted? It could be coming from elsewhere.