-(void)write
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString* path = [pathsobjectAtIndex:0];
NSString*Files =@"Account";
NSFileManager * fm = [NSFileManager defaultManager];
NSString *filePath =[NSString stringWithFormat:@"%@/%@",path,Files];
if(![fmfileExistsAtPath:filePath]) {
[fmcreateDirectoryAtPath:filePath withIntermediateDirectories:YES attributes:nil error:nil];
}
NSString * docDir = [filePath stringByAppendingPathComponent:@"************.plist"]; NSMutableDictionary *loaddic = [NSMutableDictionary dictionaryWithContentsOfFile:docDir]; NSMutableDictionary* userdic = [NSMutableDictionary dictionaryWithDictionary:loaddic[****]];
[userdic setObject:@"0" forKey:@"*****"];
for(id keyName in [load dicallKeys]) {
if([mobilNumberisEqualToString:keyName]){
loaddic[*****] = [NSMutableDictionarydictionaryWithDictionary:userdic];
}
}
[loaddic writeToFile:docDir atomically:YES];
}
- (NSMutableDictionary*)read
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString*path = [pathsobjectAtIndex:0];
NSString*Files =@"Account";
NSFileManager *fm = [NSFileManager defaultManager];
NSString *filePath =[NSString stringWithFormat:@"%@/%@",path,Files];
if(![fmfileExistsAtPath:filePath]) {
[fmcreateDirectoryAtPath:filePath withIntermediateDirectories:YES attributes:nil error:nil];
}
NSString *docDir = [filePath stringByAppendingPathComponent:@"************.plist"];
NSMutableDictionary *loadDic = [NSMutableDictionary dictionaryWithContentsOfFile:docDir];
returnloadDic;
}
网友评论