My created application crashed when executing the below lines of code
where c1 is an integer variable.
NSString *path = c1.stringValue;
Shows the following error in log:
-[NSCFString stringValue]: unrecognized selector sent to instance
0x5566e80 2011-05-11 14:56:15.813
e-TREND[1552:207] Uncaught Exception
happens!! (NSInvalidArgumentException:
-[NSCFString stringValue]: unrecognized selector sent to instance
0x5566e80) 2011-05-11 14:56:15.816
e-TREND[1552:207] * Terminating app
due to uncaught exception
'NSInvalidArgumentException', reason:
'-[NSCFString stringValue]:
unrecognized selector sent to instance
0x5566e80'
if anyone have any idea to solve this issue , please answer accordingly.
Best Answer
What does that mean? How is c1 declared?
If
c1
were anint
, thenc1.stringValue
wouldn't even compile.The dot syntax only works when the object reference --
c1
-- is of a specific object reference type (notid
) and that reference-- that class-- responds to the method.So, you have something like:
And then you are, somewhere, assigning an instance of
NSString
to that variable which leads to the crash.