{ "id": "83035", "key": "TIMOB-6286", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "12088", "description": "", "name": "Sprint 2011-48", "archived": true, "released": true, "releaseDate": "2011-12-05" }, { "id": "12571", "description": "CI for 1_7_X", "name": "Release 1.7.6", "archived": true, "released": false }, { "id": "12580", "description": "Dual Runtime 1.8.0", "name": "Release 1.8.0.1", "archived": true, "released": true, "releaseDate": "2011-12-22" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-11-29T20:00:55.000+0000", "created": "2011-11-22T16:59:22.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [], "versions": [ { "id": "11331", "description": "", "name": "Release 1.8.0", "archived": true, "released": true, "releaseDate": "2011-10-31" } ], "issuelinks": [], "assignee": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-12-16T10:42:35.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "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.\r\n\r\nReference: http://developer.apple.com/library/ios/#qa/qa1719/_index.html\r\n\r\nh4. Associated HelpDesk Ticket\r\nhttp://appc.me/c/APP-316734\r\n\r\nh4. Test\r\n\r\nNOTE: 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 with {{touch}} to include as a resource should be OK.\r\n\r\n{code}\r\nvar win = Ti.UI.createWindow({backgroundColor:'white'});\r\n\r\nvar file = Ti.Filesystem.getFile('app.js');\r\n\r\nvar b = Ti.UI.createButton({\r\n\theight:60,\r\n\twidth:200,\r\n\ttitle:\"Toggle backup\"\r\n});\r\n\r\nb.addEventListener('click', function() {\r\n\ttry {\r\n\t\tvar backup = file.remoteBackup;\r\n\t\tTi.API.info(\"Remote backup: \"+backup);\r\n\t\tfile.remoteBackup = !backup;\r\n\t}\r\n\tcatch (e) {\r\n\t\tTi.API.info(\"ERROR: \"+e);\r\n\t}\r\n});\r\n\r\nwin.add(b);\r\nwin.open();\r\n{code}", "attachment": [], "flagged": false, "summary": "iOS: \"do not back up\" flag for iOS 5.0.1", "creator": { "name": "qgao", "key": "qgao", "displayName": "Qing Gao", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "qgao", "key": "qgao", "displayName": "Qing Gao", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "iOS 5.0.1", "comment": { "comments": [ { "id": "174167", "author": { "name": "bcaufield", "key": "bcaufield", "displayName": "Brian Caufield", "active": true, "timeZone": "America/Los_Angeles" }, "body": "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.", "updateAuthor": { "name": "bcaufield", "key": "bcaufield", "displayName": "Brian Caufield", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-11-29T06:02:44.000+0000", "updated": "2011-11-29T06:02:44.000+0000" }, { "id": "174172", "author": { "name": "heenok", "key": "heenok", "displayName": "heenok", "active": true, "timeZone": "America/Los_Angeles" }, "body": "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", "updateAuthor": { "name": "heenok", "key": "heenok", "displayName": "heenok", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-11-29T07:35:42.000+0000", "updated": "2011-11-29T07:36:10.000+0000" }, { "id": "174173", "author": { "name": "jeevan", "key": "jeevan", "displayName": "Jeevan Takhar", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Co-sign 1.8.0 urgency.", "updateAuthor": { "name": "jeevan", "key": "jeevan", "displayName": "Jeevan Takhar", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-11-29T07:45:31.000+0000", "updated": "2011-11-29T07:45:31.000+0000" }, { "id": "174267", "author": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Okay, a better test and a means to verify:\r\n{code}\r\nvar newDir = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,'mydir');\r\nTi.API.info(\"Created mydir: \" + newDir.createDirectory());\r\nTi.API.info('newdir ' + newDir);\r\nvar newFile = Titanium.Filesystem.getFile(newDir.nativePath,'backup.txt');\r\nnewFile.write(\"I should be backed up!\");\r\nnewFile.remoteBackup = true;\r\n\r\nvar newFile2 = Titanium.Filesystem.getFile(newDir.nativePath,'dontbackup.txt');\r\nnewFile2.write(\"I should NOT be backed up!\");\r\nnewFile2.remoteBackup = false;\r\n{code}\r\n\r\nVerify: 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:\r\n\r\n{code}\r\nxattr -p -x \"com.apple.MobileBackup\" *\r\n{code}\r\n\r\nYou should see:\r\n{code}\r\nbackup.txt: \r\n00\r\ndontbackup.txt: \r\n01\r\n{code}", "updateAuthor": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-11-29T19:59:24.000+0000", "updated": "2011-11-29T19:59:24.000+0000" }, { "id": "174292", "author": { "name": "bcaufield", "key": "bcaufield", "displayName": "Brian Caufield", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Thanks Blain, this seems to be working with the 1.8.0.1.v20111129200258 build. \r\n\r\nA couple of questions: \r\n\r\n1) Is it sufficient to set just the folder's remoteBackup flag or will each file need to have it's remoteBackup attribute set?\r\n\r\n2) 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.\r\n\r\n3) Same for the app log file in the root of the Documents folder; does this need the remoteBackup flag too?\r\n\r\nThanks again for all your help,\r\n\r\nBrian Caufield \r\n", "updateAuthor": { "name": "bcaufield", "key": "bcaufield", "displayName": "Brian Caufield", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-11-30T07:42:44.000+0000", "updated": "2011-11-30T07:42:44.000+0000" }, { "id": "174305", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Brian -\r\n\r\nApple's technical note does not state anywhere whether this property is recursive or not. You should contact them for these details.", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-11-30T10:12:40.000+0000", "updated": "2011-11-30T10:12:40.000+0000" }, { "id": "174308", "author": { "name": "bcaufield", "key": "bcaufield", "displayName": "Brian Caufield", "active": true, "timeZone": "America/Los_Angeles" }, "body": "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.", "updateAuthor": { "name": "bcaufield", "key": "bcaufield", "displayName": "Brian Caufield", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-11-30T10:18:52.000+0000", "updated": "2011-11-30T10:18:52.000+0000" }, { "id": "174948", "author": { "name": "qgao", "key": "qgao", "displayName": "Qing Gao", "active": true, "timeZone": "America/Los_Angeles" }, "body": "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, \r\n{code}\r\nvar newDir = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,'mydir');\r\nTi.API.info(\"Created mydir: \" + newDir.createDirectory());\r\nTi.API.info('newdir ' + newDir);\r\n\r\nvar newFile = Titanium.Filesystem.getFile(newDir.nativePath,'backup.txt');\r\nnewFile.write(\"I should be backed up!\");\r\nnewDir.remoteBackup = true;\r\n{code}\r\nyou can see the folder's attribute is:\r\n{code}\r\nmydir: \r\n00\r\n{code}", "updateAuthor": { "name": "qgao", "key": "qgao", "displayName": "Qing Gao", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-12-05T16:08:46.000+0000", "updated": "2011-12-05T16:08:46.000+0000" }, { "id": "176313", "author": { "name": "heenok", "key": "heenok", "displayName": "heenok", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Does we have to install iOs SDK 5.0.1 to check this folder's attribute ?\r\n\r\nthanks.", "updateAuthor": { "name": "heenok", "key": "heenok", "displayName": "heenok", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-12-16T01:50:20.000+0000", "updated": "2011-12-16T01:50:20.000+0000" }, { "id": "176341", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This attribute only works on iOS 5.0.1 and higher, so if you want to check behavior, yes.", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-12-16T09:48:49.000+0000", "updated": "2011-12-16T09:48:49.000+0000" }, { "id": "176353", "author": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Pass: Tested with 1.8.0.1.v20111216011148 on\r\niPhone 4s (5.0.1)\r\nSimulator (5.0)\r\n", "updateAuthor": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-12-16T10:42:35.000+0000", "updated": "2011-12-16T10:42:35.000+0000" } ], "maxResults": 12, "total": 12, "startAt": 0 } } }