In my iOS 5.1 application, I’m trying to load a JSON text file into a NSDictionary.
NSString *filepath = [[NSBundle mainBundle] pathForResource:@"stuff" ofType:@"json"];
NSDictionary *stuff = [NSDictionary dictionaryWithContentsOfFile:filepath];
The filepath is valid, the file exists, but stuff is nil, which means there was a problem decoding the file (according to the documentation).
(How) Can I get more debugging information on why [NSDictionary dictionaryWithContentsOfFile:] – or any kind of API call – returns nil?
As you said: Your file contains a JSON string. First, you have to load the string and then you have to parse it using some JSON library.
E.g.: