Dependencies
"@angular/core": "^8.2.0",
"@ionic-native/sqlite": "^5.21.6",
"@ionic-native/sqlite-db-copy": "^5.21.6",
"cordova-plugin-dbcopy": "^2.1.2",
"cordova-sqlite-storage": "^4.0.0",
- Create Sqlite connection
dbName = 'Admin_1.db';
options = {
name: this.dbName,
location: 'default',
createFromLocation: 1,
};
try {
const db = await this.sqlite.create({...this.options, name: this.dbName});
if(db !== null) {
this.database = db;
this.dbReady.next(true);
}
} catch (error) {
console.log('db_err');
console.log(error);
}
- Copy existing database to default db location
let copyDb_location = 0;
if(this.platform.is('ios')) {
copyDb_location = 2;
}
this.sqliteDbCopy.copyDbFromStorage(dbName, copyDb_location, this.file.dataDirectory + 6, true)
- Works perfectly on Android but does not work on IOS.
What is the default location of SQlite database in IOS App?
I think the problem is that I’m not being able to copy existing database to correct location in IOS app but I’m not sure about it.
Thanks for helping in advance.