Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14230] iOS: cannot change remoteBackup property after updating the app

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionCannot Reproduce
Resolution Date2013-07-30T20:04:58.000+0000
Affected Version/sn/a
Fix Version/s2013 Sprint 13 API, 2013 Sprint 13, 2013 Sprint 16, 2013 Sprint 16 API
ComponentsiOS
LabelsSupportTeam
ReporterDavide Cassenti
AssigneeSabil Rahim
Created2013-06-14T10:53:39.000+0000
Updated2017-03-31T20:30:57.000+0000

Description

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.

Comments

  1. Sabil Rahim 2013-07-01

    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
  2. Sabil Rahim 2013-07-30

    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.
  3. Lee Morris 2017-03-08

    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

JSON Source