我有一个名为SketchImages的子文件夹,其中包含300个PNG图像,我需要做的是在我的应用程序启动时将此文件夹复制到iphone sdk文档文件夹中,我我想,没有运气复制文件夹从资源到文档在iphone中sdk
BOOL success;
NSFileManager *fileManager = [[NSFileManager defaultManager] init];
NSError *error;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *documentDBFolderPath = [documentsDirectory
stringByAppendingPathComponent:@"SketchImages"];
success = [fileManager fileExistsAtPath:documentDBFolderPath];
if (success)
{
return;
}else
{
NSString *resourceDBFolderPath = [[[NSBundle mainBundle] resourcePath]
stringByAppendingPathComponent:@"DB"];
//[fileManager createDirectoryAtPath: documentDBFolderPath attributes:nil];
[fileManager copyItemAtPath:resourceDBFolderPath toPath:documentDBFolderPath
error:&error];
}
任何帮助将高度appriciated
目录目录? 它会增加你的iPhone的应用程序大小... – 2012-03-02 05:21:17
我正在绘制一本书,我需要这样做 – 2012-03-02 05:35:33
当你调用copyItemAtPath时会返回什么错误? – Nevin 2012-03-02 05:55:48