Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-15796

iOS: Restoring from iCloud does not restore app's sqlite database

    Details

      Description

      Problem:

      Restoring from an iCloud backup does not restore an app's sqlite database info.

      Steps to reproduce:

      1. Create a new classic project using the code below:

      var db = Ti.Database.open('test');
      db.file.setRemoteBackup(true);
       
      db.execute('CREATE TABLE IF NOT EXISTS testtable (name TEXT)');
       
      var win = Ti.UI.createWindow({
      	backgroundColor : "pink",
      	layout : "vertical"
      });
      win.open();
       
      var button = Ti.UI.createButton({
      	top: 100,
      	title : "Click to update value"
      });
       
      button.addEventListener("click", function(e) {
      	db.execute("INSERT INTO testtable (name) VALUES (\"hello\")");
      	alert("updated");
      });
       
      var check = Ti.UI.createButton({
      	title : "Check Value"
      });
       
      check.addEventListener("click", function(e) {
      	var rows = db.execute("SELECT name FROM testtable");
       
      	while (rows.isValidRow()) {
      		alert(rows.fieldByName('name'));
      		Ti.API.info(rows.fieldByName('name'));
      		rows.next();
      	}
      	rows.close();
      	
      });
       
      win.add(button);
      win.add(check);
      

      2. Install the app on an iPhone 4 and run it
      3. Click the "Click to update value" button several times
      4. Click the "Check Value" button and see that an alert is shown for each time you pressed the "Clik to update value" button
      5. Make sure that the app data is included in iCloud backups
      6. Backup the device to iCloud
      7. Do a factory reset on the device
      8. Restore from the iCloud backup
      9. Install the app again
      10. Press the "Check value" button and see that no alert is shown

      Additional notes:

      I also tried restoring an iPhone 5 with the iPhone 4S' iCloud backup and it has the same issue.
      Factory resets were also done at the beginning of the test to ensure that the devices were "clean".

        Attachments

          Activity

            People

            • Assignee:
              srahim Sabil Rahim
              Reporter:
              ewieber Eric Wieber (Inactive)
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-17886
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Integration