dexie / Dexie.js

A Minimalistic Wrapper for IndexedDB
https://dexie.org
Apache License 2.0
11.65k stars 641 forks source link

failed to open db on ios8? #325

Open skygragon opened 8 years ago

skygragon commented 8 years ago

Here is the bt...

2016-10-05 09:06:50.641 Q.careercup[6650:727572] db open failed: Error: the statement callback raised an exception or statement error callback did not return false
From previous: 
open@file:///private/var/mobile/Containers/Bundle/Application/5FFD713A-06BD-4240-A845-2E366EECC547/Q.careercup.app/www/js/vendors/dexie.js:1829:59
open@file:///private/var/mobile/Containers/Bundle/Application/5FFD713A-06BD-4240-A845-2E366EECC547/Q.careercup.app/www/js/services/db.js:25:10
countQuestions@file:///private/var/mobile/Containers/Bundle/Application/5FFD713A-06BD-4240-A845-2E366EECC547/Q.careercup.app/www/js/services/db.js:38:12

I'm using following code, not sure what I missed?

window.shimIndexedDB.__useShim();
alert(window.indexedDB); // null
alert(window.shimIndexedDB);  // object
Dexie.dependencies.indexedDB = window.shimIndexedDB;
Dexie.dependencies.IDBKeyRange = window.IDBKeyRange;
Dexie.debug = 'dexie';
dfahlander commented 8 years ago

Should use the IDBKeyRange from the shim

Dexie.dependencies.indexedDB = window.shimIndexedDB;
Dexie.dependencies.IDBKeyRange = window.shimIndexedDB.modules.IDBKeyRange;
skygragon commented 8 years ago

Thanks! Sorry for my late reply. While I'm afraid I don't have more time recently, will tryout later and let you know the result~