Pergunta

I'm downloading lots of files in the loop and want to setMetadata for each downloaded file (to not backup in iCloud). I'm using simple code with two console.logs. The problem is that files are downloading but no console.log message is displayed. Neither error or success, nothing. Please help.

Code:

var onSetMetadataWin = function() {
    console.log("success setting metadata") 
} 
var onSetMetadataFail = function() { 
    console.log("error setting metadata") 
} 

fileTransfer.download( 
    uri, 
    filePath, 
    function(entry) { 
        entry.setMetadata(onSetMetadataWin, onSetMetadataFail, {"com.apple.MobileBackup": 1});
    }, 
    function(error) {}, 
    false 
);
Foi útil?

Solução

This is a bug in cordova-file plugin that has now been fixed in the v1.1.1dev.

If you are busting to try it out you could remove your file-transfer and file plugin and install the development (just remember to add release one back in when it's out).

cordova plugin rm org.apache.cordova.file-transfer
cordova plugin rm org.apache.cordova.file
cordova plugin add https://github.com/apache/cordova-plugin-file.git 
cordova plugin add org.apache.cordova.file-transfer

See https://issues.apache.org/jira/browse/CB-6525

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top