{ "id": "122815", "key": "TIMOB-15796", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "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": "15821", "description": "2014 Sprint 02", "name": "2014 Sprint 02", "archived": true, "released": true, "releaseDate": "2014-01-31" }, { "id": "15823", "description": "2014 Sprint 02 API", "name": "2014 Sprint 02 API", "archived": true, "released": true, "releaseDate": "2014-01-31" }, { "id": "15422", "description": "Release 3.3.0", "name": "Release 3.3.0", "archived": false, "released": true, "releaseDate": "2014-07-16" } ], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2014-01-29T22:31:55.000+0000", "created": "2013-11-22T21:41:37.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "ios", "iphone4", "iphone5", "sqlite", "supportTeam" ], "versions": [], "issuelinks": [], "assignee": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-29T22:33:03.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": "h4. Problem:\r\nRestoring from an iCloud backup does not restore an app's sqlite database info.\r\n\r\nh4. Steps to reproduce:\r\n1. Create a new classic project using the code below:\r\n{code}\r\nvar db = Ti.Database.open('test');\r\ndb.file.setRemoteBackup(true);\r\n\r\ndb.execute('CREATE TABLE IF NOT EXISTS testtable (name TEXT)');\r\n\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor : \"pink\",\r\n\tlayout : \"vertical\"\r\n});\r\nwin.open();\r\n\r\nvar button = Ti.UI.createButton({\r\n\ttop: 100,\r\n\ttitle : \"Click to update value\"\r\n});\r\n\r\nbutton.addEventListener(\"click\", function(e) {\r\n\tdb.execute(\"INSERT INTO testtable (name) VALUES (\\\"hello\\\")\");\r\n\talert(\"updated\");\r\n});\r\n\r\nvar check = Ti.UI.createButton({\r\n\ttitle : \"Check Value\"\r\n});\r\n\r\ncheck.addEventListener(\"click\", function(e) {\r\n\tvar rows = db.execute(\"SELECT name FROM testtable\");\r\n\r\n\twhile (rows.isValidRow()) {\r\n\t\talert(rows.fieldByName('name'));\r\n\t\tTi.API.info(rows.fieldByName('name'));\r\n\t\trows.next();\r\n\t}\r\n\trows.close();\r\n\t\r\n});\r\n\r\nwin.add(button);\r\nwin.add(check);\r\n{code}\r\n\r\n2. Install the app on an iPhone 4 and run it\r\n3. Click the \"Click to update value\" button several times\r\n4. Click the \"Check Value\" button and see that an alert is shown for each time you pressed the \"Clik to update value\" button\r\n5. Make sure that the app data is included in iCloud backups\r\n6. Backup the device to iCloud\r\n7. Do a factory reset on the device\r\n8. Restore from the iCloud backup\r\n9. Install the app again\r\n10. Press the \"Check value\" button and see that no alert is shown\r\n\r\nh4. Additional notes:\r\nI also tried restoring an iPhone 5 with the iPhone 4S' iCloud backup and it has the same issue.\r\nFactory resets were also done at the beginning of the test to ensure that the devices were \"clean\".", "attachment": [], "flagged": false, "summary": "iOS: Restoring from iCloud does not restore app's sqlite database", "creator": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "environment": "iPhone 4S, iPhone 5, iOS 6.1.2, iOS 7.0.3, Titanium 3.1.3.GA, iCloud", "comment": { "comments": [ { "id": "290330", "author": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Alright so this is what's happening.\n\nWe consciously made a change where database is stored in TIMOB-6273 (before the ticket: DB files was being stored in documents directory, now its being stored in `Private Documents` folder), this was done when iOS 5 introduced iCloud and apparently Apple specified that, database files should not be kept in Documents directory and should not be backed up to the cloud. Any app trying to keep DB files in documents directory, where being rejected. See [following thread|http://stackoverflow.com/questions/8612133/app-rejected-for-storing-database-in-documents-directory] for more information. \n\nSo this is by design that database files are not being backed up to the iCloud.\n\nMarking ticket as invalid. ", "updateAuthor": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-01-29T22:14:37.000+0000", "updated": "2014-01-29T22:14:37.000+0000" }, { "id": "416297", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as invalid.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-29T22:33:03.000+0000", "updated": "2017-03-29T22:33:03.000+0000" } ], "maxResults": 8, "total": 8, "startAt": 0 } } }