如何訪問plist文件中的字典中的字典中的字符串? 我試過,但它不工作:在字典中訪問字典中的字符串
NSString *myfile = [[NSBundle mainBundle] pathForResource: arrayname ofType:@"plist"];
WordsDic = [[NSDictionary alloc] initWithContentsOfFile:myfile];
words = [WordsDic allKeys];
insidedic = [[NSDictionary alloc] initWithDictionary:[[words objectAtIndex:0] ]];;
level2 = [insidedic allKeys];
然後我試過,但我得到一個錯誤
for (NSString *parent in words) {
insidedic = [WordsDic objectForKey:parent];
level2 = [insidedic allKeys];
NSLog(@"%@", level2);
}
你知道字典和字符串的關鍵嗎? –
不,它將是rondom –
使用NSLog(@「WordsDic:%@」,WordsDic);然後你會得到字典的形成。 –