拷贝文件(数据库文件)

时间:2022-09-20 22:26:41
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);//多页面操作mydata.plist
if (![[NSFileManager defaultManager] fileExistsAtPath:[[paths objectAtIndex:0] stringByAppendingPathComponent:@"mydata.plist"]]) {
if ([[NSFileManager defaultManager] copyItemAtPath:[[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"mydata.plist"] toPath:[[paths objectAtIndex:0] stringByAppendingPathComponent:@"mydata.plist"] error:nil]) {
//NSLog(@"Copy OK");
}
}

拷贝文件的代码~我懂的