Francisco Narro
Posts: 0
Joined: Thu Oct 03, 2013 9:58 am

Create file in ios

Hi, I have a routine that create a file that is working in Android, but It doesn't work in IOS.

¿Any idea?

My code:
code
var fileSystem = false;

var fnCargaSistemaFicheros = function() {
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
};

function gotFS(fs) {
fileSystem = fs;
};

function fail(error) {
fnLog('ERROR:' + error.code);
};

/* WRITE TXT */
var fnWriteFile = function(fichero) {
if (fileSystem === false) {
fnCargaSistemaFicheros();
}
fileSystem.root.getFile(fichero, {
create: true,
exclusive: false
}, gotFileEntry, fail);
};

function gotFileEntry(fileEntry) {
fileEntry.createWriter(gotFileWriter, fail);
}

function gotFileWriter(writer) {
writer.onwriteend = function(evt) {
fnLog('End write');
};
writer.write("Hello world");
}

/code

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Create file in ios

Hi Francisco,

Please take a look at here: http://docs.phonegap.com/en/2.9.0/cor...

Francisco Narro
Posts: 0
Joined: Thu Oct 03, 2013 9:58 am

Create file in ios

Thanks Katya,

At least, I could to run it.
I copy here the correct code
code
function gotFileWriter(writer) {
// writer.onwriteend = function(evt) {
writer.onwrite = function(evt) {
fnLog('End write');
};
writer.write("Hola mundo");
}

/code

Return to “Issues”