Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在该文件中有 9 个字典,每个字典有两个键。我想获得一个字典数组。我得到数组元素是:0 这是代码:
NSString * path = [[NSBundle mainBundle]pathForResource:@"List" ofType: @"plist"]; NSArray *array = [NSArray arrayWithContentsOfFile:path];
提前致谢
NSString *file = [[NSBundle mainBundle] pathForResource:@"List" ofType:@"plist"]; NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:file]; NSArray *array = [dict objectForKey:@"Array"];
希望这可以帮助
您的 plist 是字典而不是数组。所以检查一下。