I just started with iPhone development. In one of the example where I had to display some data stored in sqlite db in a table view in a tabbar controller, I had to move a sq
I just ran into this myself a few days ago. Don't force things down the Path path, embrace the NSURL path. It won't take but a short time to get how to use them.
As to the method, it's simply asking the system to hand you a URL to the standardized documents directory for the application. Use this and most everything regarding where you put new files will be correct.
heres a simple way to do it:
NSFileManager *fmngr = [[NSFileManager alloc] init];
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"mydb.sqlite" ofType:nil];
NSError *error;
if(![fmngr copyItemAtPath:filePath toPath:[NSString stringWithFormat:@"%@/Documents/mydb.sqlite", NSHomeDirectory()] error:&error]) {
// handle the error
NSLog(@"Error creating the database: %@", [error description]);
}
[fmngr release];