- (void)readPlist
{
NSFileManager *fileManager=[NSFileManager defaultManager];
NSString *filePath=@"/System/Library/CoreServices/name.plist";
if ([fileManager fileExistsAtPath: filePath]){
NSArray *arrayThatWasRead = [NSArray arrayWithContentsOfFile:filePath];
NSDictionary *dictionaryFromArrayThatWasRead = [arrayThatWasRead objectAtIndex:0];
NSString *macIDStr = [dictionaryFromArrayThatWasRead valueForKey:@"value"];
}
}
- (void)writeToPlist
{
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *filePath=@"/System/Library/CoreServices/name.plist";
NSMutableArray *idArray = [NSMutableArray array];
NSMutableDictionary *dictionary;
if(![fileManager fileExistsAtPath:filePath])
{
dictionary = [NSMutableDictionary dictionary];
[dictionary setValue:[NSString stringWithFormat:@"%@",[ServerResponse getMacAddress]] forKey:@"value"];
[idArray addObject:dictionary];
[idArray writeToFile:filePath atomically:NO];
// [self readPlist];
}
}
No comments:
Post a Comment