New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
shim does not work in iOS8 UIWebView #161
Comments
I just hit this problem myself. It looks like in the UIWebView, window.indexedDB is a readonly property set to null. I think like the solution is to use WKWebView instead of UIWebView on iOS 8. |
OK. Is that something that you've tested as a working solution? |
WKWebView has full indexedDB support so it won't need the shim. We have not yet switched to using WKWebView so we're currently working around the problem in UIWebView by having the shim and our fork of db.js work with an object named '_indexedDB' since 'indexedDB' is readonly. That's not a great general purpose workaround though. I'd love to know if anyone finds a better solution. |
OK, makes sense. I haven't delved into it further, but if that's the case you should be able to determine whether to use UIWebView or WKWebView on the fly based on the iOS version (since you need iOS8 for WKWebView), assuming the interface is the same. |
@jmeistrich how'd you go with your workaround? it seems the readonly indexedDB affects latest Safari too. |
I did look at this problem yesterday and couln't find a solution. |
Could not be this related to non-working setTimeout after lock/wake up: On 18 September 2014 12:59, Dick van den Brink notifications@github.com
Kirill (KIR) Maximov Twitter: http://twitter.com/maxkir |
I filed an issue on WebKit: https://bugs.webkit.org/show_bug.cgi?id=137034 |
@jamiejhill The workaround is working out fine. We're using db.js on top of IndexedDB and set it to use _indexedDB instead of window.indexedDB. |
Sure, but existing apps that just use In any case, Apple confirmed the issue! So hopefully it'll get fixed soon. 🎉 |
This is working for me: |
Shouldn't Safari in general be added to the poorIndexedDbSupport group due the current bug in the Mac and iOS 8 versions that make it unusable? http://www.raymondcamden.com/2014/9/25/IndexedDB-on-iOS-8--Broken-Bad |
It's a headache for me,I don't know how to fixed it |
In PouchDB, we swallowed our pride and just checked for "Safari" in the user agent. LocalForage and YDN-DB followed suit; you may want to do the same thing. :( |
Well, I would say lets do it, and check for Safari agent 😢 |
I had resolved this problem now,but thanks all the same. if (!window.indexedDB) { 2014-12-02 2:26 GMT+08:00 Parashuram N notifications@github.com:
|
I tried to add Safari to the poorBrowsers list. Turns out that at least in the ios simulator, the window.indexedDB is read only. Which means it throws a TypeError when trying to assign the shim to it. I caught the TypeError and instead hoped that the code further down in useShim that does a rewrite of the window.indexedDB property would work to use the shim. Alas, it didn't. So the shim cannot replace the iOS implementation what I can see. What I did was instead to have the browser check in my own code and use the indexedDBShim for Safari, but handle that in my own code. It turns out that was 3 lines for the extra check for me and instead of having window.indexedDB I needed to declare my own var indexedDB field in my module that I could switch the implementation for. |
Closing this issue, since it's actually a WebKit bug. The
(function() {
// This works on all browsers, and only uses IndexedDBShim as a final fallback
var indexedDB = window.indexedDB ||
window.mozIndexedDB ||
window.webkitIndexedDB ||
window.msIndexedDB ||
window.shimIndexedDB;
// This code will use the native IndexedDB, if it exists, or the shim
indexedDB.open("MyDatabase", 1);
})(); |
I have just tested using this shim in a UIWebView in iOS8 and it does not work. It works fine in iOS7 UIWebView. And while Safari iOS8 actually has indexedDB support now it seems the UIWebView still doesn't. It still supports WebSQL so the shim should still theoretically work as it did in iOS7 but it doesn't. window.indexedDB returns null.
The text was updated successfully, but these errors were encountered: