Skip to content
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

ImgCache is not working in IOS #204

Open
distribuidoralemes opened this issue Mar 31, 2017 · 5 comments
Open

ImgCache is not working in IOS #204

distribuidoralemes opened this issue Mar 31, 2017 · 5 comments

Comments

@distribuidoralemes
Copy link

I'm using imgcahe on an application with ionic 2.

It was working well but today I received the error:

Your browser does not support the html5 File API

There is a solution for this?

@ggregg
Copy link

ggregg commented Mar 31, 2017

Add cordova plugin : file, file-transfer, device :)

@gustavoschmidt
Copy link

I have the same problem in iOS even after installing the plugins (file, file-transfer, device). @distribuidoralemes Are you using cordova-plugin-wkwebview-engine?

I think the error might be related to this bug: https://issues.apache.org/jira/browse/CB-11004?jql=text%20~%20%22wkwebview%20file%22

@ggregg
Copy link

ggregg commented Apr 4, 2017

I use this plugins

<plugin name="cordova-plugin-crosswalk-webview" spec="~2.3.0" />
<plugin name="cordova-plugin-whitelist" spec="1" />
<plugin name="cordova-plugin-network-information" spec="~1.3.1" />
<plugin name="cordova-plugin-file" spec="~4.3.2" />
<plugin name="cordova-plugin-keyboard" spec="~1.1.5" />
<plugin name="cordova-plugin-file-transfer" spec="~1.6.2" />
<plugin name="cordova-plugin-device" spec="~1.1.5" />
<plugin name="cordova-plugin-console" spec="~1.0.6" />

All work fine ...

Are you sure that cordova object is defined ?

@ggregg
Copy link

ggregg commented Apr 5, 2017

If it could help, I had exactly the same error if I initialize ImgCache before Cordova.
Now I use a promise like this :

export const ImgCacheInitPromise = new Promise((resolve, reject) => {
    ImgCache.init(() => {
        resolve(ImgCache)
    }, () => {
        reject()
    })
})

Using this way like lazy loading :

ImgCacheInitPromise.then((ImgCache) => {
    //Image cache supported and initialized
    ImgCache.cacheFile(...)
    ...

}, () => {
    //Image cache not supported (debug mode in safari)
    ...
})

Hope :)

@ralphcode
Copy link

As above, I hit this when testing on iOS PhoneGap Developer app. I have accidentally commended out the include for Cordova. Try checking and ensuring this in your index;

<script type="text/javascript" src="cordova.js"></script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants