I have created a simple Xcode 4.2 project with a empty view controller.
I added a json file to this project (i not had a resouces folder/group and so i
have create these resouces folder and group).
So, in my iphone simulator i can read this json file correctly.
When i have tested my example app on my device I had a error: i can’t read the
json file: Why?
I use this simple code lines:
NSString *filePath = [[NSBundle mainBundle] pathForResource:CONFIGURATION_FILE_NAME ofType:CONFIGURATION_FILE_TYEPE];
NSString *jsonString = [[NSString alloc] initWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error: NULL];
I have solved…
in my code the CONFIGURATION_FILE_TYEPE is a define @”JSON”..
i have changed this with @”json”.. this work well on device and simulator!