0
我無法讀取plist文件中的數據。我沒有像我期待的那樣獲得在控制檯中打印的titleString。我究竟做錯了什麼? 無法讀取plist文件
NSString *path = [[NSBundle mainBundle] pathForResource:@"Events" ofType:@"plist"];
NSDictionary *dictPri = [[NSMutableDictionary alloc]initWithContentsOfFile:path];
NSMutableArray *arrEvents = [[NSMutableArray alloc] initWithArray:[dictPri valueForKey:@"Root"]];
for (NSDictionary *dict in arrEvents)
{
NSString *titleString = nil;
NSString *date = nil;
titleString = [NSString stringWithFormat:@"%@",[dict valueForKey:@"Title"]];
date = [NSString stringWithFormat:@"%@",[dict valueForKey:@"Date"]];
NSLog(@"Title String: %@", titleString);
}
餘留根作爲字典和根內建立一個數組,並添加了項目的該陣列。謝謝! – raginggoat