Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49176

Deploy Ionic Framework App With Pre-Filled SQLite DB issue resolved

$
0
0

@akhlesh_bt wrote:

Hi,

Refer this link first:

There is an issue while implementing pre-papulated database, existing database could not be open in this case.Because above link do not specify exact location where db file stored while copying.

So while you open database you have to mention its db location. Below is the filtered code:

window.plugins.sqlDB.copy("populated.db", function() {
db = $cordovaSQLite.openDB({name:"populated.db",
iosDatabaseLocation:"Documents"});
}, function(error) {
console.error("There was an error copying the database: " + error);
db = $cordovaSQLite.openDB({name:"populated.db",
iosDatabaseLocation:"Documents"});
});

Note: iosDatabaseLocation should be "Documents" because while copy db file, it automaticaly store file in documents folder.

In my case db file copy location was /Users/bayatreecomp/Library/Developer/CoreSimulator/Devices/EBEDC93E-21F4-4C90-BFA7-16F0593816F1/data/Containers/Data/Application/4C5A8E28-C326-4F17-9365-670EADF8DEF3/Documents

That's why we specify "Documents" in iosDatabaseLocation.

Thanks,
Akhlesh

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49176

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>