I downloaded JSON files. I added these files in project directory. But when I am runnig program I am getting an error which is…
-[__NSCFDictionary
JSONRepresentation]: unrecognized
selector sent to instance 0x6003d50* Terminating app due to uncaught exception
‘NSInvalidArgumentException’, reason:
‘-[__NSCFDictionary
JSONRepresentation]: unrecognized
selector sent to instance 0x6003d50’
* Call stack at first throw:
I imported header file #import "JSON/JSON.h" and I wrote jsocn code in viewDidLoad function which is like below…
NSDictionary *requestData = [NSDictionary dictionaryWithObjectsAndKeys:
@"grio", @"username",
@"hellogrio", @"password",
nil];
NSString* jsonString = [requestData JSONRepresentation];
NSLog(@"%@", jsonString);
Kindly help me.
Thanks in advance.
It’s not clear from your question which JSON implementation you’re using, but the error means that you’re sending the
JSONRepresentationmessage to anNSDictionary. The dictionary does not understand the message and raises an exception.It seems that either you’re not using the JSON library correctly or that you have not installed it correctly in your project.