Reading plist file. iOS Programming

你离开我真会死。 提交于 2019-12-07 06:21:29

Looks like you need to call objectAtIndex: first, then call objectForKey:

eg:

[[dictionary objectAtIndex:0] objectForKey:@"Name"]

Main Error:- root is array and you are taking file into dictionary.So declare a NSArray in .h file and retain,nonatomic its property.

NSString *path = [[NSBundle mainBundle] pathForResource:@"shifts" ofType:@"plist"];

array = [[NSArray alloc]initWithContentsOfFile:path];

NSLog(@"First Index Name %@",[[array objectAtIndex:0] objectForKey:@"Name"]);

I am sure it will answer your question.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!