将数据(数组)储存到.plist文件中
-(NSString *)getRecordFilePath{
NSArray *paths =NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:@"test.plist"];
return path;
}
-(NSMutableArray *)readLevelData{
NSString * filePath=[selfgetRecordFilePath];
// NSLog(@"this is filePath : %@",filePath);
self.myInfo_array=[NSKeyedUnarchiverunarchiveObjectWithFile:filePath];
if (!myInfo_array) {
[selfsetDate];
}
return myInfo_array;
}
-(void)saveLevelData {
NSString *path = [selfgetRecordFilePath];
BOOL boo=[NSKeyedArchiverarchiveRootObject:self.myInfo_arraytoFile:path];
NSLog(@"储存 bool : %d",boo);
}