I'm attempting to load data from a plist file that I've placed in my resources folder in xcode, it's named "FakeData.plist". When I try loading it into a mutable dictionary via the following code the resulting dictionary is nil. I searched the forum and online and have tried a couple different approaches I have seen but am obviously missing something.
If I log filePath it shows the full file path so it's getting that correctly, but if I log plistArr I get nil, if I log [plistArr count] it returns 0. Could it be rejecting the plist file? I've logged everything and can't figure out the next step in debugging or why it isn't loading the plist into the dictionary.
Code:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsPath = [paths objectAtIndex:0];
NSString *filePath = [documentsPath stringByAppendingPathComponent:@"FakeData.plist"];
NSMutableDictionary * plistArr = [[NSMutableDictionary alloc] initWithContentsOfFile:filePath];
if(plistArr){
NSLog(@"value is: %@", [plistArr count]);
}
If I log filePath it shows the full file path so it's getting that correctly, but if I log plistArr I get nil, if I log [plistArr count] it returns 0. Could it be rejecting the plist file? I've logged everything and can't figure out the next step in debugging or why it isn't loading the plist into the dictionary.