FDrugsPath =[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0] stringByAppendingPathComponent:@"favoriteDrug.plist"]
NSMutableDictionary* resultDict = [NSMutableDictionary dictionaryWithContentsOfFile:FDrugsPath];
if (!resultDict) {
resultDict = [NSMutableDictionary dictionary];
}
//self.drugDetail.name是从第一个页面传过来的药品名字
[resultDict setObject:self.drugDetail.name forKey:@(resultDict.allKeys.count+1).stringValue];
NSLog(@"resultDict -- %@",resultDict);
[resultDict writeToFile:FDrugsPath atomically:YES];
时间: 2024-10-19 14:55:50