chrisben / imgcache.js

JS library based on the File API to cache images for offline recovery (target: cordova/phonegap & chrome)
Other
826 stars 216 forks source link

Not working on Safari browser or IOS (ionic) #164

Open jeffthompson1971 opened 8 years ago

jeffthompson1971 commented 8 years ago

I'm using the background-image approach. I'm using this library and the angular wrapper on top. Came together quickly and works awesome on chrome browser. Then I tried using the Ionic IOS sim and it doesn't work. Then I just tried Safari browser (should have tried that first ;) ) and no luck.

I followed al the steps, I'm setting the manual init to true in my ionic app properly. (did my due diligence looking around) and I see the initialize log message. I did have a 'warn' about HTML 5 File API missing and so I installed the ionic File plugin and now I don't see that anymore so thought I was done. But now it shows only the initialized log message, but then simply doesn't work. I trace it through the debugger from teh angular directive which IS getting hit and does have the image URL being passed in so all that's totally fine, but hen it literally fall into a black hole on the ImgCache$promise() API... it never gets to the 'then' block so the promise just never resolves. I see no errors at all anywhere or any log messages for that matter.

What I DO see is in chrome in dev tools $ImgCache.ready == true, and in safari the 'ready' attribute is false. strange though I can get this far when ImgCache has it's own 'ready' attribute set to false and also strange that the code doesnt' just reject that promise in that case....

Anyway - long winded just curious if there is going to be support for IOS/Safari?

chrisben commented 8 years ago

Browser support other than Chrome has not been worked upon. "browser" as a platform for Cordova is something fairly new that will require few changes in the library, see #159. That's for Safari.

Now about iOS, it is supposed to work. Along with the many cordova and target OS changes come new bugs for this library unfortunately (change of cordova API/behaviour/extra configuration needed/...).

I don't know much about the angular/ionic wrappers for ImgCache, so if you could do some tests directly with this library (talking about imgcache.js, not qimgcache.js even), that will help making sure it's not a problem related to those wrappers. Also check the new issues related to iOS, you might learn some workarounds (configuration of config.xml most of the time) to make it work.

mixersoft commented 7 years ago

I'm testing with ionic2 and I seem to be getting this error on ImgCache.init() for iOS

[Error] ReferenceError: Can't find variable: device
    runTask (polyfills.js:3:11493)
    invoke (polyfills.js:3:15172)

with ionic2 + angular2 + typescript the device global is not being set? where should this happen?

The same code works fine in chrome browser

mixersoft commented 7 years ago

dooh! forgot cordova-plugin-device

see: https://github.com/chrisben/imgcache.js/issues/158

jdnichollsc commented 7 years ago

Any updates?