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

有帮助吗?

解决方案

images.plist is not in your "Copy Bundle Resources" build phase, drag it in and run again.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top