Categories
apache cordova ios javascript

window.requestFileSystem is undefined in ver 3.3.0

I’ve been using Cordova (with iOS) on an app I’ve been developing for some time now. I’ve been able to access filesystem just fine in the past.

I installed cordova 3.3.0 with Node via the Command Line Interface and added all the plugins I needed (pretty much all of the plugins- including file of course)

When I list the plugins, I get:
Michaels-MacBook-Pro:hello michael$ cordova plugin ls

[ 'org.apache.cordova.battery-status',
'org.apache.cordova.console',
'org.apache.cordova.device-motion',
'org.apache.cordova.device-orientation',
'org.apache.cordova.dialogs',
'org.apache.cordova.file',
etc....']

However, I try to run the following test code: note that the code is inside the index.js file, which is correctly referenced in index.html

Index.html references:

 script type="text/javascript" src="https://www.faqcode4u.com/faq/508491/cordova.js"
script type="text/javascript" src="https://www.faqcode4u.com/faq/508491/js/index.js"

index.js:

document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
alert("ready");
window.requestFileSystem(LocalFileSystem.PERSISTENT, 5*1024*1024, gotFS, fail);
}
function gotFS(fileSystem) {
alert("got fs");
alert(fileSystem.root.fullPath);
}

All I get is “ready”
If I try to alert(window.requestFileSystem); I get undefined.

Please would someone, help me sort this out? I see no reason why it shouldn’t be working.

Any help would be much appreciated!

Kind Regards,

Michael Mac Donald