[TIMOB-23698] iOS: "CFURLSetResourcePropertyForKey failed" log appears when you use Ti.Filesystem.File.setRemoteBackup
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-08-01T01:26:30.000+0000 |
Affected Version/s | Release 5.4.0 |
Fix Version/s | Release 5.4.0 |
Components | iOS |
Labels | qe-5.4.0 |
Reporter | Wilson Luu |
Assignee | Chee Kiat Ng |
Created | 2016-07-28T20:05:42.000+0000 |
Updated | 2016-08-01T17:24:41.000+0000 |
Description
*Details:* Create a classic mobile project:
CFURLSetResourcePropertyForKey failed
log appears when you use Ti.Filesystem.File.setRemoteBackup
.
Here is a related stackover [link| http://stackoverflow.com/questions/12928509/cfurlsetresourcepropertyforkey-failed-when-disable-data-backup-on-nsdocumentdire], which seems to be done in this [PR](https://github.com/appcelerator/titanium_mobile/pull/8093/files#diff-7c1c034158d43375ccc8ec33c21f4257R513) for TIMOB-23141.
*Steps to reproduce:*
Create a classic mobile project: appc new --classic
In the app.js file, replace the code with this code:
var useBackup = false;
var win = Ti.UI.createWindow({
backgroundColor: "#fff"
});
var btn = Ti.UI.createButton({
title: "Toggle remote backhup"
});
var dir = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, "test");
if (!dir.exists()) {
Ti.API.info("### Recursive directory does not exist, yet");
var newDir = dir.createDirectory();
if (!newDir) {
Ti.API.error("### Root directory could not be created");
}
else {
for (var i = 0; i < 20; i++) {
var tmp = Ti.Filesystem.getFile(dir.nativePath, "subDirectory-" + i);
if (!tmp.createDirectory()) {
Ti.API.error("### Subdirectory " + i + " could not be created!");
}
else {
Ti.API.warn("### Subdirectory " + i + " is created!");
}
}
var newFile = Ti.Filesystem.getFile(dir.nativePath, "file.txt");
if (!newFile.write('i am a monkeylord')) {
Ti.API.error("### File could not be created!");
}
else {
Ti.API.warn("### File is created!");
}
}
}
else {
Ti.API.info("### Recursive directory already exists");
}
// Ti.API.warn('### setting remoteBackup property to true');
// dir.remoteBackup = true;
btn.addEventListener("click", function() {
useBackup = !useBackup;
Ti.API.info('### useBackup ' + useBackup);
dir.setRemoteBackup(useBackup);
});
win.add(btn);
win.open();
Install app to an iOS device
Press the *Toggle remote backhup* button
*Actual:* The following log will appear:
[INFO] CFURLSetResourcePropertyForKey failed because it was passed an URL which has no scheme
*Expected:* No erroneous log should appear.
PR here: https://github.com/appcelerator/titanium_mobile/pull/8168
PR (5_4_X): https://github.com/appcelerator/titanium_mobile/pull/8175
Closing ticket as fixed. Verified that the
CFURLSetResourcePropertyForKey failed
log does not appear when you useTi.Filesystem.File.setRemoteBackup
and files are still being backed up, i.e. the fix for TIMOB-23141 still works. Tested on: Appcelerator Studio, build: 4.7.0.201607250649 Appc CLI NPM: 4.2.7 Appc CLI Core: 5.4.0-37 Arrow: 1.8.2 SDK: 5.4.0.v20160801022303 Node: v4.4.7 OS: Mac OS X (10.11.6) Devices: iphone 6 plus (9.1)