Apache Cordova
  1. Apache Cordova
  2. CB-471

LocalFileSystem.PERSISTENT "do not back up" file attribute iOS

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.9.0
    • Component/s: iOS
    • Labels:
      None

      Description

      According to the developer documentation on Apple's website: https://developer.apple.com/library/ios/#qa/qa1719/_index.html

      Starting in iOS 5.0.1 a new "do not back up" file attribute has been introduced allowing developers to clearly specify which files should be backed up. (com.apple.MobileBackup)

      Persistance is easily achievable (LocalFileSystem.PERSISTENT) but there seems to be no way of specifying if a saved file is not backed up to the iCloud or not.

      Apps may be rejected by Apple (depending on the data) if the "do not back up" file attribute is not set.

        Issue Links

          Activity

          Hide
          Shazron Abdullah added a comment -

          @cristophe no, we don't absolutely guarantee any mapping to an iOS feature - so it's ok. We can possibly change this in 2.0, but we are not changing an already released API feature until a major version.

          Show
          Shazron Abdullah added a comment - @cristophe no, we don't absolutely guarantee any mapping to an iOS feature - so it's ok. We can possibly change this in 2.0, but we are not changing an already released API feature until a major version.
          Show
          Shazron Abdullah added a comment - Fix commit - http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/32612280
          Hide
          christophe benoit added a comment -

          Though the name 'com.apple.MobileBackup' will be misleading as it won't actually be setting this parameter (or people will wonder if 1.9.0 is not using this deprecated feature). There also might be nuances between those two methods other than their primary goal (to say 'do not backup'), so the old name (com.apple.MobileBackup) will favour this misconception.

          Don't you think the JS property name also should change to something more in the lines of 'NSURLIsExcludedFromBackupKey'? - there could also be a backward compability 'com.apple.MobileBackup' property still kept by cordova API, but defined as deprecated in the documentation.

          Show
          christophe benoit added a comment - Though the name 'com.apple.MobileBackup' will be misleading as it won't actually be setting this parameter (or people will wonder if 1.9.0 is not using this deprecated feature). There also might be nuances between those two methods other than their primary goal (to say 'do not backup'), so the old name (com.apple.MobileBackup) will favour this misconception. Don't you think the JS property name also should change to something more in the lines of 'NSURLIsExcludedFromBackupKey'? - there could also be a backward compability 'com.apple.MobileBackup' property still kept by cordova API, but defined as deprecated in the documentation.
          Hide
          Shazron Abdullah added a comment -

          Actually the JS interface will still be the same, it will be transparent to the user.

          Show
          Shazron Abdullah added a comment - Actually the JS interface will still be the same, it will be transparent to the user.
          Hide
          christophe benoit added a comment -

          Cool, thanks for looking into this.

          For cordova users this might mean a different way of actually setting the preference, so it might be useful to add a note to the 1.8.x documentation about it (so that people using this new feature are warned about a future change).

          Show
          christophe benoit added a comment - Cool, thanks for looking into this. For cordova users this might mean a different way of actually setting the preference, so it might be useful to add a note to the 1.8.x documentation about it (so that people using this new feature are warned about a future change).
          Hide
          Shazron Abdullah added a comment -

          See updated Apple technote to handle it for iOS 5.1 or greater. The current way has been deprecated.

          Show
          Shazron Abdullah added a comment - See updated Apple technote to handle it for iOS 5.1 or greater. The current way has been deprecated.
          Hide
          Shazron Abdullah added a comment -

          That new function wasn't there in the technote when I implemented this - Apple must have updated this recently. We definitely want to update the implementaton. Re-opening for 1.9.0.

          Show
          Shazron Abdullah added a comment - That new function wasn't there in the technote when I implemented this - Apple must have updated this recently. We definitely want to update the implementaton. Re-opening for 1.9.0.
          Hide
          christophe benoit added a comment - - edited

          I had a look at the first commit (CDVFile.m file) and it's using a now deprecated method to set the 'do not backup' attribute according to:
          http://developer.apple.com/library/ios/#qa/qa1719/_index.html

          "Warning The code that follows has been deprecated and should only be used on iOS 5.0.1 or earlier. When running in iOS 5.1, apps should use the NSURL and CFURL keys described above."

          I guess you want to keep backward compatibility with ios 5.0.1 and earlier, but, in the case of iOS, forward compatibility looks more important as most devices are up to date. with iOS 6 coming soon, this fix looks already obsolete.

          Wouldn't that be possible to use the new methods when available, and fallback to the old method if necessary?

          Show
          christophe benoit added a comment - - edited I had a look at the first commit (CDVFile.m file) and it's using a now deprecated method to set the 'do not backup' attribute according to: http://developer.apple.com/library/ios/#qa/qa1719/_index.html "Warning The code that follows has been deprecated and should only be used on iOS 5.0.1 or earlier. When running in iOS 5.1, apps should use the NSURL and CFURL keys described above." I guess you want to keep backward compatibility with ios 5.0.1 and earlier, but, in the case of iOS, forward compatibility looks more important as most devices are up to date. with iOS 6 coming soon, this fix looks already obsolete. Wouldn't that be possible to use the new methods when available, and fallback to the old method if necessary?
          Hide
          Shazron Abdullah added a comment -

          We're prepping 1.8.0rc1 today. You'll have to visit PhoneGap.com and/or its blogs for the announcement.

          Show
          Shazron Abdullah added a comment - We're prepping 1.8.0rc1 today. You'll have to visit PhoneGap.com and/or its blogs for the announcement.
          Hide
          Jonathan Stevens added a comment -

          Then I assume I would just set the attribute on the Backups directory, right?

          I need to resubmit my app for review ASAP. I have a custom build of Cordova that fixes the issue, but I'd rather submit with 1.8 if it's done on time. Any ideas as to when we might see 1.8?

          Show
          Jonathan Stevens added a comment - Then I assume I would just set the attribute on the Backups directory, right? I need to resubmit my app for review ASAP. I have a custom build of Cordova that fixes the issue, but I'd rather submit with 1.8 if it's done on time. Any ideas as to when we might see 1.8?
          Hide
          Shazron Abdullah added a comment -

          Yes it will - that's why it was fixed. You'll have to set it through the API, for any file or folder that you want.

          Show
          Shazron Abdullah added a comment - Yes it will - that's why it was fixed. You'll have to set it through the API, for any file or folder that you want.
          Hide
          Jonathan Stevens added a comment - - edited

          I second Lee's comment. Will this fix the websql and localstorage backup issues? My app got rejected because of the automatic backup process saving files where iCloud backed them up. I am having to custom-build Cordova for now in order to add the NSURLIsExcludedFromBackupKey attribute to the backup file.

          Show
          Jonathan Stevens added a comment - - edited I second Lee's comment. Will this fix the websql and localstorage backup issues? My app got rejected because of the automatic backup process saving files where iCloud backed them up. I am having to custom-build Cordova for now in order to add the NSURLIsExcludedFromBackupKey attribute to the backup file.
          Show
          Shazron Abdullah added a comment - Fix commits: http://git-wip-us.apache.org/repos/asf?p=incubator-cordova-ios.git;a=commit;h=c6dc03acfee633c4ea84e0bc6a94e92a2d2993ef http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/8b369515
          Hide
          Shazron Abdullah added a comment -

          By consensus - the devs have agreed to add a setMetadata option on the FileEntry object. Implementing.

          Show
          Shazron Abdullah added a comment - By consensus - the devs have agreed to add a setMetadata option on the FileEntry object. Implementing.
          Hide
          Lee Crossley added a comment -

          Essentially, we should be able to specify if a file is to be backed up or not (possibly when calling window.requestFileSystem). In my workaround, I'm creating a directory, setting the attribute on it and saving files I don't want backed up in there.

          There is also a problem with the way you back up web sqlite databases - is also backed up on iCloud. If non-critical data is stored in there this is incorrect and apps will be rejected. This should be configurable.

          Show
          Lee Crossley added a comment - Essentially, we should be able to specify if a file is to be backed up or not (possibly when calling window.requestFileSystem). In my workaround, I'm creating a directory, setting the attribute on it and saving files I don't want backed up in there. There is also a problem with the way you back up web sqlite databases - is also backed up on iCloud. If non-critical data is stored in there this is incorrect and apps will be rejected. This should be configurable.
          Hide
          Shazron Abdullah added a comment -

          @Lee What do you suggest on how the API should work? What would you expect?

          Show
          Shazron Abdullah added a comment - @Lee What do you suggest on how the API should work? What would you expect?
          Hide
          Lee Crossley added a comment -
          Show
          Lee Crossley added a comment - I have created a work around for now, posted here: http://stackoverflow.com/questions/10085653/phonegap-cordova-1-5-ios-do-not-back-up-file-attribute
          Hide
          Filip Maj added a comment -

          Mayhaps Shaz can take a look

          Show
          Filip Maj added a comment - Mayhaps Shaz can take a look

            People

            • Assignee:
              Shazron Abdullah
              Reporter:
              Lee Crossley
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development