//=================NSKeyedArchiver========================
NSString *saveStr1 =@"This is";
NSString *saveStr2 =@"Data";
NSArray *array = [NSArray arrayWithObjects:saveStr1, saveStr2, nil];
//----Save
//合成完整路徑
NSString *Path =[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES) objectAtIndex:0];
NSString *filename = [Path stringByAppendingPathComponent:@"saveDatatest"];
[NSKeyedArchiver archiveRootObject:array toFile:filename];
//----Load
array = [NSKeyedUnarchiver unarchiveObjectWithFile: filename];
沒有留言:
張貼留言