getting data from plist to NSMutableArray and writing the NSMutableArray to same plist iPhone

后端 未结 3 934
情歌与酒
情歌与酒 2020-12-20 10:05

Using this code I am trying to get the data from Templates.plist file but I am getting null value in array.

//from plist
NSString *path = [[NSBundle mainBund         


        
3条回答
  •  时光取名叫无心
    2020-12-20 10:29

    To get a plist into a mutable array, use this class method:

    NSMutableArray *array = [NSMutableArray arrayWithContentsOfFile:path];
    

    Then, add/delete strings from the array. To save the array back to a plist, use:

    [array writeToFile:path atomically:YES];
    

提交回复
热议问题