Apache Cordova
  1. Apache Cordova
  2. CB-1561

Using Storage API - rejected by Apple

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0.0, 2.1.0, 2.2.0
    • Fix Version/s: 2.2.0
    • Component/s: iOS
    • Labels:
      None
    • Environment:
      • Cordova 2.0 on iOS

      Description

      our App uses the Sotrage-API to store data which is being loaded upon first launch.
      The app is rejected given the following reasoning:
      'Your app does not follow the iOS Data Storage Guidelines, as required by the App Store Review Guidelines.

      Please be sure to set the "Do not back up" attribute for all data which is not generated or modified by the user. To check how much data your app is storing:

      • Install and launch your app
      • Go to Settings > iCloud > Storage and Backup > Manage Storage
      • If necessary, select "Show all apps"
      • Check your app's storage

      The iOS Data Storage Guidelines indicate that only content that the user creates using your app, (documents, new files, edits, etc.) may be stored in the /Documents directory - and backed up to iCloud.

      Temporary files used by your app should only be stored in the /tmp directory. Please remember to delete the files stored in this location when the user exits the app.

      Data that can be recreated but must persist for proper functioning of your app or because customers expect it to be available for offline use should be appended with the "do not back up" attribute. For NSURL objects, add the NSURLIsExcludedFromBackupKey attribute to prevent the corresponding file from being backed up. For CFURLRef objects, use the corresponding kCFURLIsExcludedFromBackupKey attribute.

      For more information, please see Technical Q&A 1719: How do I prevent files from being backed up to iCloud and iTunes?.

      Please revise your app so that it adheres to the iOS Data Storage Guidelines.'

      Is there a possibility to set this flag for the WebSQL Database file(s)?

      At least for us this is a blocker ...

      1. CDVLocalStorage.m.diff
        1 kB
        Clemens Wyss
      2. disable_icloud_backup.diff
        2 kB
        Michal Mocny

        Activity

        Clemens Wyss created issue -
        Michal Mocny made changes -
        Field Original Value New Value
        Assignee Shazron Abdullah [ shazron ] Michal Mocny [ mmocny ]
        Hide
        Michal Mocny added a comment -

        Taking a look into this one. Ideally we can change the local storage output path to something that isn't backed up by iCloud (though that does introduce issues with restoring current files after an upgrade).

        Alternatively I will look into the possibility of flagging this data to not be backed up by iCloud (as has already been mentioned).

        Show
        Michal Mocny added a comment - Taking a look into this one. Ideally we can change the local storage output path to something that isn't backed up by iCloud (though that does introduce issues with restoring current files after an upgrade). Alternatively I will look into the possibility of flagging this data to not be backed up by iCloud (as has already been mentioned).
        Hide
        Michal Mocny added a comment -

        This should be fixed as of today: https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-ios.git;a=commit;h=6e170879aa37d33701739fc3c28ed9f78156bf1f

        I've moved the backup directory into the Library folder and out of Documents. It's odd that in ios6 Apple actually gives the explicit option to save into documents and backup to iCloud these exact files, but we decided we didn't want to do that anyway.

        Please let me know if this addresses you issue!

        Also, I've tried to take care to make sure we restore any old databases from any old locations so all app upgrades work seamlessly, please let me know if I got anything wrong!

        Show
        Michal Mocny added a comment - This should be fixed as of today: https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-ios.git;a=commit;h=6e170879aa37d33701739fc3c28ed9f78156bf1f I've moved the backup directory into the Library folder and out of Documents. It's odd that in ios6 Apple actually gives the explicit option to save into documents and backup to iCloud these exact files, but we decided we didn't want to do that anyway. Please let me know if this addresses you issue! Also, I've tried to take care to make sure we restore any old databases from any old locations so all app upgrades work seamlessly, please let me know if I got anything wrong!
        Michal Mocny made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.2.0 [ 12322549 ]
        Resolution Fixed [ 1 ]
        Hide
        Clemens Wyss added a comment - - edited

        Our app was still/yet again rejected. Same reasoning:
        "In particular, we found that on launch and/or content download, your app still stores 6.06 MB. To check how much data your app is storing:

        • Install and launch your app
        • Go to Settings > iCloud > Storage & Backup > Manage Storage
        • If necessary, tap "Show all apps"
        • Check your app's storage

        The iOS Data Storage Guidelines indicate that only content that the user creates using your app, e.g., documents, new files, edits, etc., should be backed up by iCloud.

        Temporary files used by your app should only be stored in the /tmp directory; please remember to delete the files stored in this location when the user exits the app.

        Data that can be recreated but must persist for proper functioning of your app - or because customers expect it to be available for offline use - should be marked with the "do not back up" attribute. For NSURL objects, add the NSURLIsExcludedFromBackupKey attribute to prevent the corresponding file from being backed up. For CFURLRef objects, use the corresponding kCFURLIsExcludedFromBackupKey attribute.
        "
        Looking at your patch:
        you are not making use of the NSURLIsExcludedFromBackupKey attribute, are you?

        Show
        Clemens Wyss added a comment - - edited Our app was still/yet again rejected. Same reasoning: "In particular, we found that on launch and/or content download, your app still stores 6.06 MB. To check how much data your app is storing: Install and launch your app Go to Settings > iCloud > Storage & Backup > Manage Storage If necessary, tap "Show all apps" Check your app's storage The iOS Data Storage Guidelines indicate that only content that the user creates using your app, e.g., documents, new files, edits, etc., should be backed up by iCloud. Temporary files used by your app should only be stored in the /tmp directory; please remember to delete the files stored in this location when the user exits the app. Data that can be recreated but must persist for proper functioning of your app - or because customers expect it to be available for offline use - should be marked with the "do not back up" attribute. For NSURL objects, add the NSURLIsExcludedFromBackupKey attribute to prevent the corresponding file from being backed up. For CFURLRef objects, use the corresponding kCFURLIsExcludedFromBackupKey attribute. " Looking at your patch: you are not making use of the NSURLIsExcludedFromBackupKey attribute, are you?
        Clemens Wyss made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Clemens Wyss made changes -
        Affects Version/s 2.2.0 [ 12322549 ]
        Clemens Wyss made changes -
        Affects Version/s 2.1.0 [ 12322462 ]
        Hide
        Clemens Wyss added a comment -

        Just made the following "changes" (see diff). iCloud usage was reduced from 6M to 0.7k.
        Submitting the app with this change and let you know if it "really helps"

        Show
        Clemens Wyss added a comment - Just made the following "changes" (see diff). iCloud usage was reduced from 6M to 0.7k. Submitting the app with this change and let you know if it "really helps"
        Clemens Wyss made changes -
        Attachment CDVLocalStorage.m.diff [ 12549473 ]
        Hide
        Clemens Wyss added a comment -

        the attached patch reduced iCloud usage of our app from 6M to 0.7k.
        Resubmitted the app with this patch.
        Will let you know if it "helps"

        Show
        Clemens Wyss added a comment - the attached patch reduced iCloud usage of our app from 6M to 0.7k. Resubmitted the app with this patch. Will let you know if it "helps"
        Hide
        Michal Mocny added a comment -

        Thanks for the patch, and curious how it goes this time.

        I was under the impression iCloud only backed up files in the Documents folder, and I've moved the backups out into the Library folder, which is meant for app specific files (http://developer.apple.com/library/mac/#documentation/FileManagement/Conceptual/FileSystemProgrammingGUide/FileSystemOverview/FileSystemOverview.html).

        About Library folder: "This directory is the top-level directory for files that are not user data files. You typically put files in one of several standard subdirectories but you can also create custom subdirectories for files you want backed up but not exposed to the user. You should not use this directory for user data files."

        I'll read further into this, and take a second pass as the ios6 changes, but I was not aware I needed to use NSURLIsExcludedFromBackupKey for files there.

        Show
        Michal Mocny added a comment - Thanks for the patch, and curious how it goes this time. I was under the impression iCloud only backed up files in the Documents folder, and I've moved the backups out into the Library folder, which is meant for app specific files ( http://developer.apple.com/library/mac/#documentation/FileManagement/Conceptual/FileSystemProgrammingGUide/FileSystemOverview/FileSystemOverview.html ). About Library folder: "This directory is the top-level directory for files that are not user data files. You typically put files in one of several standard subdirectories but you can also create custom subdirectories for files you want backed up but not exposed to the user. You should not use this directory for user data files." I'll read further into this, and take a second pass as the ios6 changes, but I was not aware I needed to use NSURLIsExcludedFromBackupKey for files there.
        Hide
        Michal Mocny added a comment -

        Found this note: "In iOS 5.0.1 and later, put support files in the <Application_Home>/Library/Application Support directory and apply the com.apple.MobileBackup extended attribute to them. This attribute prevents the files from being backed up to iTunes or iCloud. If you have a large number of support files, you may store them in a custom subdirectory and apply the extended attribute to just the directory."

        Show
        Michal Mocny added a comment - Found this note: "In iOS 5.0.1 and later, put support files in the <Application_Home>/Library/Application Support directory and apply the com.apple.MobileBackup extended attribute to them. This attribute prevents the files from being backed up to iTunes or iCloud. If you have a large number of support files, you may store them in a custom subdirectory and apply the extended attribute to just the directory."
        Show
        Michal Mocny added a comment - http://developer.apple.com/library/ios/#qa/qa1719/_index.html
        Hide
        Michal Mocny added a comment -

        Attaching a patch, similar to yours, but handles ios 5.0 as well as 5.1+, and additionally changes the location on the backup directory (likely not needed, but is advised in docs, and at this point I'de like to be thorough).

        Clemens: Because of the change of backup location, if I land this patch, you should not deploy your app as is or else you will have to support yet another legacy backup location.

        Show
        Michal Mocny added a comment - Attaching a patch, similar to yours, but handles ios 5.0 as well as 5.1+, and additionally changes the location on the backup directory (likely not needed, but is advised in docs, and at this point I'de like to be thorough). Clemens: Because of the change of backup location, if I land this patch, you should not deploy your app as is or else you will have to support yet another legacy backup location.
        Michal Mocny made changes -
        Attachment disable_icloud_backup.diff [ 12549523 ]
        Hide
        Michal Mocny added a comment -

        I should add, I wrote the patch but am still working on varification. The test I was using was not writing enough data to the database to make a dent in iCloud storage either way. Going to write an app to puts a few megs of data in there, and try again.

        In the mean time, if you can try to apply the patch to your app, that would be great to verify as well.

        Show
        Michal Mocny added a comment - I should add, I wrote the patch but am still working on varification. The test I was using was not writing enough data to the database to make a dent in iCloud storage either way. Going to write an app to puts a few megs of data in there, and try again. In the mean time, if you can try to apply the patch to your app, that would be great to verify as well.
        Hide
        Samuel Michelot added a comment -

        Hi All,
        Thanks for working on this issues. I am waiting for phonegap 2.2 to update my app, but I can't afford another user data loss, otherwise I will loose all credibility.
        It's a pity that we have to change the backup location... Please, make sure to keep the option to backup the data in iCloud (if it's user generated data).
        Thanks,

        Show
        Samuel Michelot added a comment - Hi All, Thanks for working on this issues. I am waiting for phonegap 2.2 to update my app, but I can't afford another user data loss, otherwise I will loose all credibility. It's a pity that we have to change the backup location... Please, make sure to keep the option to backup the data in iCloud (if it's user generated data). Thanks,
        Hide
        Michal Mocny added a comment -

        Samuel,
        I really hope there will not be any data loss, I have tried to make sure all upgrade paths are covered.
        This most recent folder location change should not affect anyone, since the folder location is already changing from 2.1 release – this is just changing the changed location – unless you submitted an app using the git repo version of cordova, you will not be affected.

        As far as leaving the option to backup data to iCloud – that option is not possible for localstorage/websql, so I have not included a user setting for it. Any data saved by your app into the users' documents folder will continue to backup as you expect.

        Show
        Michal Mocny added a comment - Samuel, I really hope there will not be any data loss, I have tried to make sure all upgrade paths are covered. This most recent folder location change should not affect anyone, since the folder location is already changing from 2.1 release – this is just changing the changed location – unless you submitted an app using the git repo version of cordova, you will not be affected. As far as leaving the option to backup data to iCloud – that option is not possible for localstorage/websql, so I have not included a user setting for it. Any data saved by your app into the users' documents folder will continue to backup as you expect.
        Hide
        Clemens Wyss added a comment -

        what if we just applied the NSURLIsExcludedFromBackupKey and reverted the two changes you have made for this issue? Wouldn't that make sure we lose no data?

        Show
        Clemens Wyss added a comment - what if we just applied the NSURLIsExcludedFromBackupKey and reverted the two changes you have made for this issue? Wouldn't that make sure we lose no data?
        Hide
        Samuel Michelot added a comment - - edited

        Michael,
        Thanks for answering. But please, localstorage and websql data are crucial for most of the apps, they really need iCloud backup, because it's data created by the users. I have more than 16 apps using WebSQL in iTunes, and I never get rejected because of space on iCloud. Maybe you can speak with Shazron? he was working on that part after the iOS 5.1 bug.
        Thanks,

        Sam

        Show
        Samuel Michelot added a comment - - edited Michael, Thanks for answering. But please, localstorage and websql data are crucial for most of the apps, they really need iCloud backup, because it's data created by the users. I have more than 16 apps using WebSQL in iTunes, and I never get rejected because of space on iCloud. Maybe you can speak with Shazron? he was working on that part after the iOS 5.1 bug. Thanks, Sam
        Hide
        Michal Mocny added a comment -

        Those changes are not really optional, the 2.1 release had us saving LocalStorage for backup to iCloud, which in hindsight was a mistake.
        Further, we were backing up to the Documents folder, which NSURLIsExcludedFromBackupKey or not, is not meant to store data other than specific user created content.

        If you have specific concerns, please let me know.

        Did you happen to check if the patch provided also solved your issue?

        Show
        Michal Mocny added a comment - Those changes are not really optional, the 2.1 release had us saving LocalStorage for backup to iCloud, which in hindsight was a mistake. Further, we were backing up to the Documents folder, which NSURLIsExcludedFromBackupKey or not, is not meant to store data other than specific user created content. If you have specific concerns, please let me know. Did you happen to check if the patch provided also solved your issue?
        Hide
        Michal Mocny added a comment -

        Samuel, This bug is specifically filed requesting to NOT backup localstorage/websql files to iCloud (or rather the local backups).

        == As an aside ==

        There is a new ios6 feature to request localstorage backup to iCloud, which was "incorrectly" enabled in cordova 2.1, which I've changed back to disabled for 2.2.
        If some app developers like you really do want to backup to iCloud, then I can add a setting for it, but to be clear that would only work for ios6 anyway.

        More importantly, I am not sure that syncing these files will release achieve what you expect. We had a discussion on the cordova mailing list if it made sense to backup these files to iCloud, and the answer was no – but there was not really much debate or data here, and perhaps we should revisit the issue. What are your specific reasons for wanting this, so that we can consider them?

        Show
        Michal Mocny added a comment - Samuel, This bug is specifically filed requesting to NOT backup localstorage/websql files to iCloud (or rather the local backups). == As an aside == There is a new ios6 feature to request localstorage backup to iCloud, which was "incorrectly" enabled in cordova 2.1, which I've changed back to disabled for 2.2. If some app developers like you really do want to backup to iCloud, then I can add a setting for it, but to be clear that would only work for ios6 anyway. More importantly, I am not sure that syncing these files will release achieve what you expect. We had a discussion on the cordova mailing list if it made sense to backup these files to iCloud, and the answer was no – but there was not really much debate or data here, and perhaps we should revisit the issue. What are your specific reasons for wanting this, so that we can consider them?
        Hide
        Samuel Michelot added a comment - - edited

        Hi Michael,
        Every data generated by the user must be backup by iCloud. LocaStorage/WebSql files have always been backup by iCloud or iTunes since the beginning of phonegap (Library, and Document folder are backup in iCloud, except the Cache folder). I think most of the phonegap apps store user data in localstorage or WebSQL. If it's not backup by iCloud, users will loose their data when they upgrade iOS or when they change their devices. I think LocalStorage and WebSQL should be backup by default, but phonegap should provide an option to not backup LocalStorage/WebSQL on the case where it's only used as a cache for data available on internet.
        Please, don't break again localstorage.
        Thanks,

        Sam

        Show
        Samuel Michelot added a comment - - edited Hi Michael, Every data generated by the user must be backup by iCloud. LocaStorage/WebSql files have always been backup by iCloud or iTunes since the beginning of phonegap (Library, and Document folder are backup in iCloud, except the Cache folder). I think most of the phonegap apps store user data in localstorage or WebSQL. If it's not backup by iCloud, users will loose their data when they upgrade iOS or when they change their devices. I think LocalStorage and WebSQL should be backup by default, but phonegap should provide an option to not backup LocalStorage/WebSQL on the case where it's only used as a cache for data available on internet. Please, don't break again localstorage. Thanks, Sam
        Hide
        Michal Mocny added a comment -

        Samuel,
        Localstorage was never directly backed up to iCloud before ios6, and while we did accidentally backup a COPY of localstorage (was only intended to be a local backup), apps are now apparently starting to get rejected by apple app review for doing this, so that needs to be disabled.

        No one wants to break Localstorage, and we are re-evaluating whether to enable icloud backup on ios6 for other reasons, but if you want to have user data backed up to iCloud, we suggest using the FileSystem API. Localstorage is not considered data generated by the user.

        Show
        Michal Mocny added a comment - Samuel, Localstorage was never directly backed up to iCloud before ios6, and while we did accidentally backup a COPY of localstorage (was only intended to be a local backup), apps are now apparently starting to get rejected by apple app review for doing this, so that needs to be disabled. No one wants to break Localstorage, and we are re-evaluating whether to enable icloud backup on ios6 for other reasons, but if you want to have user data backed up to iCloud, we suggest using the FileSystem API. Localstorage is not considered data generated by the user.
        Hide
        Samuel Michelot added a comment - - edited

        Michal,
        I am sorry but I insist! WebSQL was stored in Library before iOS5.1 (this directory as always been backup by iTunes then iCloud). After iOS 5.1 Apple did the mistake to store the WebSQL files in the Cache folder, but phonegap made a fix to backup in the Document folder (again this folder is backup by iTunes and iCloud). And also Apple realize that it was a mistake that's why the introduce the "Do not back up" attribute for apps that do not need backups.
        And yes, WebSQL is mostly used to store user generated data, so it needs backup. If you broke that, users will lost their precious data again.
        And it's not possible to switch easily from WebSQL to FileSystem, WebSQL use complex SQL request...

        Show
        Samuel Michelot added a comment - - edited Michal, I am sorry but I insist! WebSQL was stored in Library before iOS5.1 (this directory as always been backup by iTunes then iCloud). After iOS 5.1 Apple did the mistake to store the WebSQL files in the Cache folder, but phonegap made a fix to backup in the Document folder (again this folder is backup by iTunes and iCloud). And also Apple realize that it was a mistake that's why the introduce the "Do not back up" attribute for apps that do not need backups. And yes, WebSQL is mostly used to store user generated data, so it needs backup. If you broke that, users will lost their precious data again. And it's not possible to switch easily from WebSQL to FileSystem, WebSQL use complex SQL request...
        Hide
        Samuel Michelot added a comment -

        I am going to write a post on the phonegap group in order to show you that I am not the only one using WebSQL to store user generated data.

        Show
        Samuel Michelot added a comment - I am going to write a post on the phonegap group in order to show you that I am not the only one using WebSQL to store user generated data.
        Hide
        Michal Mocny added a comment -

        Samuel, I totally understand what you are saying – but you are not understanding me – It is Apple's policy, not cordova's or my decision, that is causing this issue.

        We can do nothing about it.

        Still, after all changes are made, I will let you know how to modify cordova to re-enable iCloud backup and you can take your chances with the review process.

        Show
        Michal Mocny added a comment - Samuel, I totally understand what you are saying – but you are not understanding me – It is Apple's policy, not cordova's or my decision, that is causing this issue. We can do nothing about it. Still, after all changes are made, I will let you know how to modify cordova to re-enable iCloud backup and you can take your chances with the review process.
        Hide
        Samuel Michelot added a comment - - edited

        Thanks Michal, but this is not about Apple policy but phonegap policy. WebSQL and localstorage are in the phonegap docs : http://docs.phonegap.com/en/2.1.0/cordova_storage_storage.md.html#Storage

        It's not written that the database and localstorage can't be used to store user generated data.

        And Apple will not reject apps that use Storage to store user generated data... (I have recent apps approved by Apple)

        To fix this issue, you should add a setting to prevent the backup from iCloud in case that Storage is used to cache data, but you should not break all the other existing apps using Storage to store important data.

        Thanks in advance Michal

        Show
        Samuel Michelot added a comment - - edited Thanks Michal, but this is not about Apple policy but phonegap policy. WebSQL and localstorage are in the phonegap docs : http://docs.phonegap.com/en/2.1.0/cordova_storage_storage.md.html#Storage It's not written that the database and localstorage can't be used to store user generated data. And Apple will not reject apps that use Storage to store user generated data... (I have recent apps approved by Apple) To fix this issue, you should add a setting to prevent the backup from iCloud in case that Storage is used to cache data, but you should not break all the other existing apps using Storage to store important data. Thanks in advance Michal
        Hide
        Michal Mocny added a comment -

        Well Samuel, you've made your case. Its pretty clear that you value this feature, and I certainly don't plan to force you otherwise

        I'll add a flag to chose which option you want, and post back on details tomorrow.

        Show
        Michal Mocny added a comment - Well Samuel, you've made your case. Its pretty clear that you value this feature, and I certainly don't plan to force you otherwise I'll add a flag to chose which option you want, and post back on details tomorrow.
        Hide
        Samuel Michelot added a comment -

        Great, thank you for your work Michal. Phonegap team rocks

        I will help to test 2.2 RC1

        Show
        Samuel Michelot added a comment - Great, thank you for your work Michal. Phonegap team rocks I will help to test 2.2 RC1
        Hide
        Michal Mocny added a comment -

        np, I'm glad you put your foot down to help me make the right decision.

        rc1 is tagged already, wait for rc2. I'll let you know when patches land.

        Show
        Michal Mocny added a comment - np, I'm glad you put your foot down to help me make the right decision. rc1 is tagged already, wait for rc2. I'll let you know when patches land.
        Hide
        Samuel Michelot added a comment -

        Ok, waiting for rc2 then. I know that it's not an easy feature, lot of case to test (different path of migrations, different iOS version etc.).

        Show
        Samuel Michelot added a comment - Ok, waiting for rc2 then. I know that it's not an easy feature, lot of case to test (different path of migrations, different iOS version etc.).
        Hide
        Shazron Abdullah added a comment -

        Michal I believe your patches have landed - is there any more that needs to be done for resolution?

        Show
        Shazron Abdullah added a comment - Michal I believe your patches have landed - is there any more that needs to be done for resolution?
        Hide
        Michal Mocny added a comment -

        Yes they landed, no there is nothing else that needs to be done – except verification.

        I do plan on adding 1 patch to replace some hard coded strings with constants but it shouldn't change functionality.

        There was a report of an error with ios5.0.1 but I'm not sure how my patches can be the cause.

        Show
        Michal Mocny added a comment - Yes they landed, no there is nothing else that needs to be done – except verification. I do plan on adding 1 patch to replace some hard coded strings with constants but it shouldn't change functionality. There was a report of an error with ios5.0.1 but I'm not sure how my patches can be the cause.
        Hide
        Samuel Michelot added a comment -

        2.2 RC2 still not released? I can help to test...

        Show
        Samuel Michelot added a comment - 2.2 RC2 still not released? I can help to test...
        Hide
        Michal Mocny added a comment -

        Sam, seems not officially yet, but close! Either way you could also grab tip of tree to test, if you are already set up to do that.

        Thanks.

        Show
        Michal Mocny added a comment - Sam, seems not officially yet, but close! Either way you could also grab tip of tree to test, if you are already set up to do that. Thanks.
        Hide
        Samuel Michelot added a comment -

        Hi Michal,
        I found a bug, the migration from iOS5.1 to iOS6 doesn't work, because the file are moved to Webkit/Databases directory instead of WebKit/LocalStorage.
        To fix the bug, just change the "Databases" refs to LocalStorage :
        // ////////// WEBSQL MAIN DB

        original = [targetDir stringByAppendingPathComponent:targetDirNests ? @"WebKit/LocalStorage/Databases.db":@"Databases.db"];
        backup = [backupDir stringByAppendingPathComponent:(backupDirNests ? @"WebKit/LocalStorage":@"")];

        ...

        // ////////// WEBSQL DATABASES

        original = [targetDir stringByAppendingPathComponent:targetDirNests ? @"WebKit/LocalStorage/file__0":@"file__0"];
        backup = [backupDir stringByAppendingPathComponent:(backupDirNests ? @"WebKit/LocalStorage":@"")];

        Show
        Samuel Michelot added a comment - Hi Michal, I found a bug, the migration from iOS5.1 to iOS6 doesn't work, because the file are moved to Webkit/Databases directory instead of WebKit/LocalStorage. To fix the bug, just change the "Databases" refs to LocalStorage : // ////////// WEBSQL MAIN DB original = [targetDir stringByAppendingPathComponent:targetDirNests ? @"WebKit/LocalStorage/Databases.db":@"Databases.db"] ; backup = [backupDir stringByAppendingPathComponent:(backupDirNests ? @"WebKit/LocalStorage":@"")] ; ... // ////////// WEBSQL DATABASES original = [targetDir stringByAppendingPathComponent:targetDirNests ? @"WebKit/LocalStorage/file__0":@"file__0"] ; backup = [backupDir stringByAppendingPathComponent:(backupDirNests ? @"WebKit/LocalStorage":@"")] ;
        Hide
        Samuel Michelot added a comment -

        And the migration from iOS 5.0 to iOS5.1 doesn't work either. The code should move the WebKit/LocalStorage to Caches/ folder.

        Show
        Samuel Michelot added a comment - And the migration from iOS 5.0 to iOS5.1 doesn't work either. The code should move the WebKit/LocalStorage to Caches/ folder.
        Hide
        Michal Mocny added a comment -

        Databases are stored in the LocalStorage directory? I took the WebKit/Databases path right from the cordova 2.0 release that supported migration from 5.0 to 5.1.

        Did migrating from 5.0 to 5.1 never work?

        Show
        Michal Mocny added a comment - Databases are stored in the LocalStorage directory? I took the WebKit/Databases path right from the cordova 2.0 release that supported migration from 5.0 to 5.1. Did migrating from 5.0 to 5.1 never work?
        Hide
        Michal Mocny added a comment -

        migration from ios5.0 to 5.1 was not added – this wasn't supported before either.

        I did add migration from 5.1 to 6.0 which is currently relevant. Is there any reason anyone is still on 5.0 and will be upgrading?

        Show
        Michal Mocny added a comment - migration from ios5.0 to 5.1 was not added – this wasn't supported before either. I did add migration from 5.1 to 6.0 which is currently relevant. Is there any reason anyone is still on 5.0 and will be upgrading?
        Hide
        Michal Mocny added a comment -

        Samuel, seems you are right. Updating change now – not sure how this used to work.

        Show
        Michal Mocny added a comment - Samuel, seems you are right. Updating change now – not sure how this used to work.
        Hide
        Michal Mocny added a comment -

        Okay, it looks like the location for websql was WebKit/Databases folder in 5.0, changed to Caches in 5.1, and then to WebKit/LocalStorage in 6.0.

        Working on confirmation (pulling 5.0 simulator), and updating plugin now.

        Show
        Michal Mocny added a comment - Okay, it looks like the location for websql was WebKit/Databases folder in 5.0, changed to Caches in 5.1, and then to WebKit/LocalStorage in 6.0. Working on confirmation (pulling 5.0 simulator), and updating plugin now.
        Hide
        Aaron Moman added a comment -

        It looks like the new configuration is all or nothing. Meaning both local storage and WebSql databases are iCloud, local or no backup, but you can't have separate settings for local storage and databases. Is that correct? If so, can you change it so that each are configurable separately? I have data that needs to be backed up in local storage, but a database that shouldn't be backed up.

        Sorry to make this even more complicated than it already is...

        Thanks,
        Aaron

        Show
        Aaron Moman added a comment - It looks like the new configuration is all or nothing. Meaning both local storage and WebSql databases are iCloud, local or no backup, but you can't have separate settings for local storage and databases. Is that correct? If so, can you change it so that each are configurable separately? I have data that needs to be backed up in local storage, but a database that shouldn't be backed up. Sorry to make this even more complicated than it already is... Thanks, Aaron
        Hide
        Michal Mocny added a comment -

        Aaron,
        You are correct, this is all or nothing. The feature you request is not supported, has not been, and would be difficult to do well given that the iOS6 UserDefaults value for cloud backup is also all-or-nothing.

        However, I think there is another workaround for you: if you enable local-backup-only, then you can use the File API to reset metadata on the LocalStorage backups to re-enable cloud backup just for that. (NSURLIsExcludedFromBackupKey on Documents/Backups/

        {localstorage file or whichever you need}

        using File API's FileEntry.setMetadata function)

        If the workaround is insufficient, please file a feature request, and patches are welcome for 2.3 release.

        Show
        Michal Mocny added a comment - Aaron, You are correct, this is all or nothing. The feature you request is not supported, has not been, and would be difficult to do well given that the iOS6 UserDefaults value for cloud backup is also all-or-nothing. However, I think there is another workaround for you: if you enable local-backup-only, then you can use the File API to reset metadata on the LocalStorage backups to re-enable cloud backup just for that. (NSURLIsExcludedFromBackupKey on Documents/Backups/ {localstorage file or whichever you need} using File API's FileEntry.setMetadata function) If the workaround is insufficient, please file a feature request, and patches are welcome for 2.3 release.
        Hide
        Samuel Michelot added a comment - - edited

        Michal : No, at least in the simulator, the location for WebSQL in iOS 5.0 is also WebKit/LocalStorage
        I can't say if it's was working before, because I was using an older version of phonegap with a migration patch (if it's help, here is the code : https://gist.github.com/3975955 ), basically it's only copying from WebKit to Cache.

        It's useful at least for the first gen iPad upgrading to 5.1 (their latest iOS version available :https://en.wikipedia.org/wiki/List_of_iOS_devices#iPad)

        Show
        Samuel Michelot added a comment - - edited Michal : No, at least in the simulator, the location for WebSQL in iOS 5.0 is also WebKit/LocalStorage I can't say if it's was working before, because I was using an older version of phonegap with a migration patch (if it's help, here is the code : https://gist.github.com/3975955 ), basically it's only copying from WebKit to Cache. It's useful at least for the first gen iPad upgrading to 5.1 (their latest iOS version available : https://en.wikipedia.org/wiki/List_of_iOS_devices#iPad )
        Hide
        Michal Mocny added a comment -

        Samuel, I've just downloaded ios5.0 simulator and I see websql stores in Library/WebKit/Databases/

        My reading of the old migration patch suggests it never worked anyway, but I haven't tried it yet.

        Either way, I'm not sure that migration from 5.0 is something that needs fixing. I will update the 5.1->6.0, however.

        Show
        Michal Mocny added a comment - Samuel, I've just downloaded ios5.0 simulator and I see websql stores in Library/WebKit/Databases/ My reading of the old migration patch suggests it never worked anyway, but I haven't tried it yet. Either way, I'm not sure that migration from 5.0 is something that needs fixing. I will update the 5.1->6.0, however.
        Hide
        Michal Mocny added a comment -

        Samuel, Yes I agree about the first gen iPad, but anyway who would be updating to 5.1 on it would have done so months ago, right?

        Show
        Michal Mocny added a comment - Samuel, Yes I agree about the first gen iPad, but anyway who would be updating to 5.1 on it would have done so months ago, right?
        Hide
        Michal Mocny added a comment -

        ios5.1: March 7, 2012

        Show
        Michal Mocny added a comment - ios5.1: March 7, 2012
        Hide
        Michal Mocny added a comment -

        5.1->6.0 should work properly now.

        For some reason I was still getting proper backups locally even with the wrong patch – I think that when you set the ios6 cloud backup user default it may automatically restore from the old location – but the way I am testing is by moving folders around across ios simulator version app directories, not by actually upgrading.

        Show
        Michal Mocny added a comment - 5.1->6.0 should work properly now. For some reason I was still getting proper backups locally even with the wrong patch – I think that when you set the ios6 cloud backup user default it may automatically restore from the old location – but the way I am testing is by moving folders around across ios simulator version app directories, not by actually upgrading.
        Hide
        Samuel Michelot added a comment -

        Ok, sorry, you are right, WebKit/Databases for ios 5.0

        With a large user base, you can be sure that every migration path will be used. I you don't want to handle that case, I will have to handle it in my AppDelegate.

        I am also testing by moving folders across iOS simulator folder.

        Thanks for your work Michal!

        Show
        Samuel Michelot added a comment - Ok, sorry, you are right, WebKit/Databases for ios 5.0 With a large user base, you can be sure that every migration path will be used. I you don't want to handle that case, I will have to handle it in my AppDelegate. I am also testing by moving folders across iOS simulator folder. Thanks for your work Michal!
        Hide
        Michal Mocny added a comment -

        Marking this as fixed since the original scope of this bug is no longer being discussed.

        If we think migration from 5.0 is still important, we can file another issue.

        If we want more fine grained customization of cloud backup, and file api setMetadata is insufficient, we can file another issue.

        Show
        Michal Mocny added a comment - Marking this as fixed since the original scope of this bug is no longer being discussed. If we think migration from 5.0 is still important, we can file another issue. If we want more fine grained customization of cloud backup, and file api setMetadata is insufficient, we can file another issue.
        Michal Mocny made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        4d 7h 13m 1 Michal Mocny 05/Oct/12 15:28
        Resolved Resolved Reopened Reopened
        11d 15h 27m 1 Clemens Wyss 17/Oct/12 06:56
        Reopened Reopened Resolved Resolved
        13d 12h 16m 1 Michal Mocny 30/Oct/12 18:13

          People

          • Assignee:
            Michal Mocny
            Reporter:
            Clemens Wyss
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development