I’m having trouble with a method to read my plist:
@synthesize data //NSMutableArray
-(void)readPlist{
plistFilePath = [NSString stringWithString:[[NSBundle mainBundle] pathForResource:@"myPlist" ofType:@"plist"]];
data = [[NSMutableArray alloc] initWithContentsOfFile:plistFilePath];
//here I use data, it doesn't matter for what
[data release
}
If I do NSLog(@"%@", data) after data = [[NSMutableArray alloc] initWithContentsOfFile : plistFilePath]; Xcode says data’s empty. I can’t find any error in the code, what’s wrong?
Your plist is not an array, it is a dictionary, so you should be using NSMutableDictionary instead.