至於我能看到的是你有對象的陣列,這裏是在doc目錄寫一個數組到一個plist文件的代碼
//look at this code which creates path to plist in documents directory:
NSArray *paths =NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:@"data.plist"];
// >Lists
// >>List1
// >>>Item1
// >>>>Item1Details
// >>>Item2
// >>>>Item2Details
// >>>etc.
// >>List2
// >>>Item1
// >>>>Item1Details
// >>etc.
NSArray *list1Arry = [NSArray arrayWithObjects:@"item1Detail",@"item2Detail",@"item3Detail", nil];
NSArray *list2Arry = [NSArray arrayWithObjects:@"item1Detail",@"item2Detail",@"item3Detail", nil];
NSArray *list3Arry = [NSArray arrayWithObjects:@"item1Detail",@"item2Detail",@"item3Detail", nil];
NSArray *lists = [NSArray arrayWithObjects:list1Arry,list2Arry,list3Arry, nil];
[lists writeToFile: path atomically:YES];