Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SURVEY] Change default iOS location to prevent iCloud backup [BREAKING CHANGE]? #430

Closed
brodycj opened this issue Feb 18, 2016 · 9 comments

Comments

@brodycj
Copy link
Contributor

brodycj commented Feb 18, 2016

In February 2015 I published a change with a location option that can be used to select the location of the database for iOS. Using location: 2 would store the database in Library/LocalDatabase which will NOT be backed up by iCloud [1: #143]. I did not make this the default option since I wanted to avoid breaking existing app code.

As a consequence, PouchDB had to also add a location option [2: #200] [3: pouchdb/pouchdb#3617].

I would like to change the plugin to store the database in Library/LocalDatabase by default for some reasons including:

As @dilignt wrote in [7 - https://github.com//issues/143#issuecomment-77147967]:

This fix is wrong - there should be an option to disable backup to iCloud
without using the openDatabase call, and the default should have backup
off, not on. Using this plugin with PouchDB gives me no option to disable
backup without editing 3rd party source code, either PouchDB or the plugin.

I fixed this issue in the previous version by changing NSDocumentDirectory
to NSLibraryDirectory in the source, but this no longer works and I'm back
to square one.

Please disable the backup to iCloud

The downside to this change is that it would potentially break some applications and libraries that depend on this plugin. Existing apps for iOS that do not use the location option would have to explicitly add this option in order to use the database from the old default location.

An additional change I would like to make is to introduce an iosLocation option (perhaps with different values) and deprecate the existing location option.

A note with a link to this survey is going into README.md. I would like to ask the user community to comment as follows:

  • If you do not like this change then please write something like -1, stupid idea. Please feel free to add a reason.
  • If you do like this change please add a +1 comment and feel free to add a reason.
  • If there is anything else you would like to say please feel free to add a comment.
  • If there is anything you would like to say privately please feel free to write to info@litehelpers.net or brodybits@litehelpers.net

I will leave this open for 2-3 weeks and take all input seriously.

references:

  1. Not to backup to iCloud Options(iOS) #143
  2. How to use new location option with pouchdb? #200
  3. Implement new 'location' option for SQLite Plugin pouchdb/pouchdb#3617 - Implement new 'location' option for SQLite Plugin
  4. https://developer.apple.com/library/mac/documentation/General/Conceptual/iCloudDesignGuide/Chapters/iCloudFundametals.html
  5. [FEATURE] Improved coordination with iCloud backup #370 (comment)
  6. [Build] BackupWebStorage No Longer Works phonegap/build#338 (comment)
  7. Not to backup to iCloud Options(iOS) #143 (comment)
brodycj pushed a commit to brodycj/Cordova-sqlite-storage-common-dev that referenced this issue Feb 18, 2016
brodycj pushed a commit to brodycj/Cordova-sqlite-storage-common-dev that referenced this issue Feb 18, 2016
@johanneswilm
Copy link

+1 makes it easier to get an app up and running and accepted into the Apple app store.

@mentimjojo
Copy link

Indeed, way easier for ios! Lets do it!

@kanoshin
Copy link

+1 my app was rejected because of this, so I had to spent one more week waiting for another review to finally release the app

@mbunkin
Copy link

mbunkin commented Feb 20, 2016

+1 - it certainly should not violate AppStore rules by default. Plugins in cordova do not get upgraded automatically; when authors upgrade plugins, they should always check for backwards compatibility. It's not too difficult to add a piece of code that will move databases from old location for their existing users, and it will have to be done anyway to get app approved.

@brodycj
Copy link
Contributor Author

brodycj commented Feb 23, 2016

Thanks for the feedback, I will make this change sometime in March.

@brunoravanhani
Copy link

+1

@Andrew1431
Copy link

Hey there what is the status and / or if it is fixed now, how do I make sure my application is using the proper directory? Thanks

@brodycj
Copy link
Contributor Author

brodycj commented Mar 11, 2016

I will still need a couple of weeks or so. Until this is fixed, please use the location: 2 option in openDatabase as documented in README.md. Apps that do not use the location option in openDatabase will be broken by this change.

@brodycj
Copy link
Contributor Author

brodycj commented Mar 25, 2016

I have added a new, more explicit iosDatabaseLocation openDatabase/deleteDatabase option and made it mandatory to specify the iOS database location in openDatabase and deleteDatabase.

This will definitely break some app source code but would avoid a more silent upgrade issue.

In case someone needs to overwrite window.openDatabase, it can be done with something like this (edited):

window.openDatabase = function(dbname, ignored1, ignored2, ignored3) {
  return window.sqlitePlugin.openDatabase({name: dbname, iosDatabaseLocation: 'default'});
};

In the case of PouchDB it would be mandatory to use the location parameter. I plan to add an Android location option and will ask the PouchDB team to add the new options once they are all ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants