实现 简单 的文件 储存
+(NSString *)getInitFilePath{
NSString * fileName=@"init.plist";
NSArray * paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSLog(@"this is paths : %@",paths);
NSString * path=[paths objectAtIndex:0];
NSLog(@"this is path : %@",path);
NSString * filePath=[path stringByAppendingPathComponent:fileName];
NSLog(@"this is filePath :%@",filePath);
return filePath;
}
+(void) createDataFile{
NSString * filePath=[Test6_16AppDelegategetInitFilePath];
NSArray *array=[[NSArrayalloc]initWithObjects:@"11111",@"222222",@"3333333",nil];
[NSKeyedArchiverarchiveRootObject:array toFile:filePath];
}
+(NSMutableArray *)getArray{
staticNSMutableArray *array;
NSLog(@"this is array : %@",array);
array=[NSKeyedUnarchiver unarchiveObjectWithFile:[Test6_16AppDelegategetInitFilePath]];
return array;
}