incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clemens Wyss DEV <clemens...@mysign.ch>
Subject iOS : setMetadata on backup file/directory does not work
Date Tue, 02 Oct 2012 06:28:40 GMT
Environment: Cordova 2.0 on iOS

Trying to set "do-not-copy-toiCloud"-metadata on the backuped WebSQL files/directories fails.
Here my code (mostly copied from http://docs.phonegap.com/en/2.1.0/cordova_file_file.md.html#FileEntry
):

function setMetadata( filePath, metadataKey, metadataValue, isFile ) 
{
var onSetMetadataWin = function() {
  alert( "success setting metadata " + filePath )
}
var onSetMetadataFail = function( error ) {
  alert( "error setting metadata " + filePath + "(" + error + ")" )
}

var onGetFileWin = function(parent) {
  parent.setMetadata(onSetMetadataWin, onSetMetadataFail, { metadataKey: metadataValue});
}
var onGetFileFail = function() {
  alert( "error getting file " + filePath )
}

var onFSWin = function(fileSystem) {
	if ( isFile )
		fileSystem.root.getFile( filePath, { create: false, exclusive: false }, onGetFileWin, onGetFileFail
);
	else
		fileSystem.root.getDirectory( filePath, { create: false, exclusive: false }, onGetFileWin,
onGetFileFail );
}

var onFSFail = function(evt) {
  alert(evt.target.error.code);
}

window.requestFileSystem( LocalFileSystem.PERSISTENT, 0, onFSWin, onFSFail );
}...
setMetadata( "Backups/websqldbs.appdata.db", "com.apple.MobileBackup", 1, false );
setMetadata( "Backups/websqlmain.appdata.db", "com.apple.MobileBackup", 1, true );

I end up in onSetMetadataFail, hence the file/directory-entry is found. 
Unfortunately I don't know the structure oft he error object, so I have no details about the
exact error ...

Could this be related to https://issues.apache.org/jira/browse/CB-1566 ?

Mime
View raw message