Advertise here

Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sqlite Create empty copy to DocDirectory

jitendrajitendra Posts: 59New Users @
edited April 2013 in iOS SDK Development
i tried this code for create sqlite database.and copy into documentdirectory.genrate null copy of database into document directory.

code i have tried this

- (void) checkAndCreateDatabase { // Name Of Database NSFileManager * filemanager=[NSFileManager defaultManager]; NSString *databasefilepathfromapp=[[[NSBundle mainBundle]resourcePath]stringByAppendingPathComponent:@"MathsTricks.sqlite"]; NSString * databasename=@"MathsTricks.sqlite"; NSArray * documentpath=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSAllDomainsMask, YES); NSString * DocDir=[documentpath objectAtIndex:0]; NSLog(@"%@",DocDir); NSString *databasepath=[DocDir stringByAppendingPathComponent:databasename]; BOOL sucess; sucess=[filemanager fileExistsAtPath:databasepath]; if(sucess) return; [filemanager copyItemAtPath:databasefilepathfromapp toPath:databasepath error:nil]; }

please help me out thanks in advance.
Sign In or Register to comment.