我有一个pList,其中我有5个Dictionary项。我正在尝试将这个词典读成数组
NSString *plistPath =
[[NSBundle mainBundle] pathForResource:@"pListName" ofType:@"plist"];
NSArray *myArray = [NSArray dictionaryWithContentsOfFile:plistPath];
NSLog(@"%d", myArray.count);
但“myArray”一直都是空的......我做错了什么?提前谢谢......
答案 0 :(得分:2)
NSArray *myArray = [NSArray dictionaryWithContentsOfFile:plistPath];
应该是:
NSArray *myArray = [NSArray arrayWithContentsOfFile:plistPath];
和
myArray.count
应该是[myArray count]
(正如乔提到的那样)