如何检查plist的根项是数组还是字典? 谢谢你的帮助
答案 0 :(得分:1)
使用以下方法,您可以通过objective-C
检测字典的根元素是否为数组NSString *thePath = [[NSBundle mainBundle] pathForResource:@"YourCustom" ofType:@"plist"];
NSURL *theUrl = [NSURL fileURLWithPath:thePath];
id messagesInfo = [[NSDictionary dictionary] initWithContentsOfURL:theUrl];
if([messagesInfo isKindOfClass:NSDictionary]){
NSLog(@"DictionaryFound");
}
else{
NSLog(@"Array Found");
}