读取方法
//获得plist文件的路径
NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"SearchHistory" ofType:@"plist"];
//从路径中读取文件,取决于你的plist文件里的属性
_historyArray=[[NSMutableArray alloc] initWithContentsOfFile:plistPath];
写入方法
//获得plist文件的路径
NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"SearchHistory" ofType:@"plist"];
//你也可以用这种获得路径的方法,反正我不怎么用
//获取应用程序沙盒的Documents目录
NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
NSString *plistPath1 = [paths objectAtIndex:0];
//得到完整的文件名
//NSString *filename=[plistPath1 stringByAppendingPathComponent:@"SearchHistory.plist"];
//输入写入
[_historyArray writeToFile:filename atomically:YES];