문제

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