拷贝文件(数据库文件)

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");
}
}

拷贝文件的代码~我懂的

posted @ 2011-11-01 09:30  痴人指路  阅读(171)  评论(0编辑  收藏  举报