我在我的應用程序中創建數據庫,創建Db後,我試圖將數據庫從應用程序包複製到Doc目錄。但是我無法複製它,我得到的錯誤如 操作無法完成。 (可可錯誤260) 下面顯示的是我在用的代碼,請大家幫我解決這個問題在iphone中集成sqlite
dbName="userDetails.db";
returnCode=sqlite3_open(dbName,&handler);
if(returnCode!=SQLITE_OK)
NSLog(@"message---%s",sqlite3_errmsg(handler));
else
NSLog(@"sucess---%d",returnCode);
NSFileManager *fmgr=[NSFileManager defaultManager];
NSError *error;
NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
NSString *path=[paths objectAtIndex:0];
NSString *docPath=[path stringByAppendingPathComponent:@"userDetails.db"];
if(![fmgr fileExistsAtPath:docPath]){
NSString *defaultDBPath=[[[NSBundle mainBundle]resourcePath]stringByAppendingPathComponent:@"userDetails.db"];
if(![fmgr copyItemAtPath:defaultDBPath toPath:docPath error:&error])
NSLog(@"failure message----%@",[error localizedDescription]);
}