At first i’m trying to access local file in my app folder:
NSData *data = [NSData dataWithContentsOfFile:
[@"countries.json" stringByExpandingTildeInPath]];
result is always NULL
then i tried to check is file exists:
NSString* documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString* foofile = [documentsPath stringByAppendingPathComponent:@"countries.json"];
BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:foofile];
it doesn’t exist, and i use following code to access my json file:
NSString *data1 = [[NSBundle mainBundle] pathForResource:@"countries" ofType:@"json"];
NSData *data2 = [[NSData alloc] initWithContentsOfFile:data1];
it getting the file but when i try to parse it:
NSDictionary *dict1 =[data2 yajl_JSON];
i getting an error:
[NSConcreteData yajl_JSON]: unrecognized selector sent to instance 0x6838d60
My questions is next:
-
Is there any chance to convert NSData to NSConcreteData?
-
Am i using the right approach to access data?
Api documentation – http://gabriel.github.com/yajl-objc/
Screenshot of my Xcode Build Phases:

According to the YAJL documentation the method you are trying to invoke does in fact exist.
That leaves only one option; you have not fully linked against the YAJL framework.
Make sure it shows up within the list of linked frameworks/libraries of your App target just like
CFNetwork.frameworkshows up in my example.Since the method you are trying to invoke is in fact part of a category on
NSData, make sure you include-ObjCin your Other Linker Flags.From Apple’s Technical Q&A.