Invalid CfStringRef plist (Array of dictionaries) iOS
-
01-06-2021 - |
Question
I have the following code in my file
NSString *filePath = [[NSBundle mainBundle]pathForResource:@"images" ofType:@"plist"];
NSArray *array = [[NSArray alloc]initWithContentsOfFile:filePath];
for (id dict in array) {
NSLog(@"This is the id: %@" ,[dict objectForKey:@"Id"]);
}
When I run this on the debugger it comes back saying 'invalid CfStringref' on the NSString *filePath line.
No matter what code I try I cannot get past this.
Any ideas?
Also the plist is a Array of dictionaries but I can't get to parse them since the code won't work
Solution
images.plist is not in your "Copy Bundle Resources" build phase, drag it in and run again.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow