Thursday, November 8, 2012

Copy From Resource Folder to Document Directory in iPhone SDK


NSFileManager *fileManager = [NSFileManager defaultManager];

NSError *error;

NSArray *paths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory,
NSUserDomainMask, YES);

NSString *documentsDirectory = [paths objectAtIndex:0];

NSString *documentDBFolderPath = [documentsDirectory stringByAppendingPathComponent:@"YourFolderName"];

NSString *resourceDBFolderPath = [[[NSBundle mainBundle] resourcePath]
stringByAppendingPathComponent:@"YourFolderName"];

    [fileManager copyItemAtPath:resourceDBFolderPath toPath:documentDBFolderPath error:&error];
   


No comments:

Post a Comment