Problem description
When a file is set NOT to be backed up (remoteBackup = false), it is not possible to turn it to true with an update of the app.
Steps to reproduce
1) Create the following app
var f = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, "nobackup");
var g = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, "backupme");
if(f.exists()) {
alert("nobackup exists!");
} else {
var xhr = Ti.Network.createHTTPClient({
onload: function() {
var f = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, "nobackup");
f.write(this.responseData);
f.setRemoteBackup(false);
alert("nobackup created");
}
});
xhr.open("GET", "http://www.appcelerator.com.s3.amazonaws.com/web/home/carousels/home-platform.jpg");
xhr.send();
}
if(g.exists()) {
alert("backupme exists!");
} else {
var xhr = Ti.Network.createHTTPClient({
onload: function() {
var g = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, "backupme");
g.write(this.responseData);
alert("backupme created");
}
});
xhr.open("GET", "http://www.appcelerator.com.s3.amazonaws.com/web/home/carousels/home-platform.jpg");
xhr.send();
}
2) Run the app: you will get the messages 'backupme created' and 'nobackup created'.
3) Connect the iPhone to iTunes
4) Backup the device
5) Restore the device
6) Run the app again: now you get 'backupme exists' and 'nobackup created'
7) Update the app to look like:
if(f.exists()) {
alert("nobackup exists!");
f.setRemoteBackup(true);
} else {
var xhr = Ti.Network.createHTTPClient({
onload: function() {
var f = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, "nobackup");
f.write(this.responseData);
f.setRemoteBackup(true);
alert("nobackup created");
}
});
xhr.open("GET", "http://www.appcelerator.com.s3.amazonaws.com/web/home/carousels/home-platform.jpg");
xhr.send();
}
if(g.exists()) {
alert("backupme exists!");
} else {
var xhr = Ti.Network.createHTTPClient({
onload: function() {
var g = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, "backupme");
g.write(this.responseData);
alert("backupme created");
}
});
xhr.open("GET", "http://www.appcelerator.com.s3.amazonaws.com/web/home/carousels/home-platform.jpg");
xhr.send();
}
8) Update the app on the device
9) Run the app: you will get once again 'backupme exists' and 'nobackup created'
10) Repeat the backup and restore steps
11) Run the app after the restore: again you get 'nobackup created'
Expected result
Since the remoteBackup property for the file has been changed, both file should exist after the restore.
Cannot reproduce the issue on actual icloud backup. This ticket should be actually marked as invalid as the testing instructions provided is invalid. the remoteBackup flag is to control what files are backed up to the cloud and not locally to the computer. None the less following the steps provided in the ticket also i was not able to reproduce the issue. Marking as cannot reproduce for now. Tested on iPad runnign 6.0 and TiSDK 3.1.1.GA build iOS SDK 6.1
Testing with the latest 3.1.X build using the latest Xcode 5 DP 4 and could not reproduce the issue . It would as expected. Build the app using the first code. Opened it backed it up. Restored from backup . opened the app.. observerd behavior as expected. Rebuild the app using the second test case. open app. Backedup the device. Restore the device from app. Opened the app and saw both files in the documents folder of the app. (verified the files exist using another tool) So i cannot reproduce the fail case anymore.
Cannot reproduce this issue, tested with the following environment; iPhone 7 and Simulator (10.2) MacOS 10.11.6 (15G31) Studio 4.8.1.201612050850 Ti SDK 6.0.2 GA Appc NPM 4.2.8 Appc CLI 6.1.0 Ti CLI 5.0.11 Alloy 1.9.5 Arrow 1.10.1 Xcode 8.2 (8C38) Node v4.6.0 Java 1.7.0_80