[TIMOB-6286] iOS: "do not back up" flag for iOS 5.0.1
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-11-29T20:00:55.000+0000 |
Affected Version/s | Release 1.8.0 |
Fix Version/s | Sprint 2011-48, Release 1.7.6, Release 1.8.0.1 |
Components | iOS |
Labels | n/a |
Reporter | Qing Gao |
Assignee | Stephen Tramer |
Created | 2011-11-22T16:59:22.000+0000 |
Updated | 2011-12-16T10:42:35.000+0000 |
Description
iOS 5.0.1 introduces a new "do not back up" file attribute allowing developers to clearly specify which files should be backed up, which files are local caches only and subject to purge. Our Ti SDK should provide a new function to set this flag for iOS 5.0.1 devices.
Reference: http://developer.apple.com/library/ios/#qa/qa1719/_index.html
Associated HelpDesk Ticket
http://appc.me/c/APP-316734Test
NOTE: This test will not work on apps compiled for device in TiStudio; you will need to change the file to a non-application resources (no .js or .html) to check the bit toggle on it. Creating a stubbed out file withtouch
to include as a resource should be OK.
var win = Ti.UI.createWindow({backgroundColor:'white'});
var file = Ti.Filesystem.getFile('app.js');
var b = Ti.UI.createButton({
height:60,
width:200,
title:"Toggle backup"
});
b.addEventListener('click', function() {
try {
var backup = file.remoteBackup;
Ti.API.info("Remote backup: "+backup);
file.remoteBackup = !backup;
}
catch (e) {
Ti.API.info("ERROR: "+e);
}
});
win.add(b);
win.open();
I think this feature should be included in the 1.8.0 release considering that this issue either prevents applications from getting accepted by the app store (due to storing data in the documents folder w/o a DNBU flag), or alternatively risks the complete loss of app data by forcing the app to store data in the "Caches" folder which is the only location that doesn't get backed up and as such, is the only location where it is OK to store data w/o this flag.
This is a big problem. My clients are waiting for an apple validation and with this issue i have no solution to give. Could we have a workaround soon ? Thanks
Co-sign 1.8.0 urgency.
Okay, a better test and a means to verify:
Verify: Go to the folder in question, eg "~/Library/Application Support/iPhone Simulator/5.0/Applications/69AB55BF-3B49-40CB-8510-E083629724E8/Documents/mydir" and run the following command:
You should see:
Thanks Blain, this seems to be working with the 1.8.0.1.v20111129200258 build. A couple of questions: 1) Is it sufficient to set just the folder's remoteBackup flag or will each file need to have it's remoteBackup attribute set? 2) Do we need to set this flag for the app's property list file in the Documents/Preferences folder too? I would actually prefer if this was backed up but I don't know if Apple's guidelines allow it. 3) Same for the app log file in the root of the Documents folder; does this need the remoteBackup flag too? Thanks again for all your help, Brian Caufield
Brian - Apple's technical note does not state anywhere whether this property is recursive or not. You should contact them for these details.
Re: Question #1 - after some testing, it appears that when the remoteBackup flag is applied to a folder, it will prevent the backup of all the files it contains.
According to http://developer.apple.com/library/ios/#qa/qa1719/_index.html, there is line saying "In addition, setting this attribute on a folder will prevent the folder and all of its contents from being backed up." The remoteBackup flag in TiSDK sets the same attribute to either a folder or a file. So for Question #1, Yes, it is sufficient to just set the folder's flag. If I modify Blain's sample a little bit,
you can see the folder's attribute is:
Does we have to install iOs SDK 5.0.1 to check this folder's attribute ? thanks.
This attribute only works on iOS 5.0.1 and higher, so if you want to check behavior, yes.
Pass: Tested with 1.8.0.1.v20111216011148 on iPhone 4s (5.0.1) Simulator (5.0)