Adding and reading json file in iPhone application

I created a simple Xcode 4.2 project with an empty controller. I added a json file to this project (I did not have a resouces folder / group, and so I create these folders and a resouces group). So, in my iphone simulator, I can read this json file correctly. When I tested my application on my device, I had an error: I cannot read json file: Why? I use these simple lines of code:

NSString *filePath = [[NSBundle mainBundle] pathForResource:CONFIGURATION_FILE_NAME ofType:CONFIGURATION_FILE_TYEPE]; 
NSString *jsonString = [[NSString alloc] initWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error: NULL];
+5
source share
1 answer

... CONFIGURATION_FILE_TYEPE @ "JSON" . @ "json" . !

+4

All Articles