You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2020/08/12 07:36:51 UTC

[GitHub] [cordova-ios] gerhardsletten edited a comment on issue #906: Migration of local storage

gerhardsletten edited a comment on issue #906:
URL: https://github.com/apache/cordova-ios/issues/906#issuecomment-672692414


   @jcesarmobile 
   
   > You can keep using file protocol if you don't configure the scheme and your data will still be there. If you set the scheme then data won't be accessible as the url changes (not lost, the data is still there).
   
   For a regular cordova app, this is not correct, at least for localstorage. After what I can see cordova-ios-6.x will create new files to store localstorage, I inspected the filesystem for the simulator.
   
   The original name of the localstorage-file seems to be `WebKit/LocalStorage/file__0.localstorage`, while the new name will depends on the scheme and hostname set in config.xm, so if you set 
   
   ```
   <preference name="scheme" value="app" />
   <preference name="hostname" value="localhost" />
   ```
   the new location will be `WebKit/WebsiteData/LocalStorage/app_localhost_0.localstorage`
   
   To migrate this none of the plugins mentions here worked out of the box:
   https://github.com/kassamina/cordova-plugin-ionic-migrate-storage#thanks
   
   But I used [https://github.com/jairemix/cordova-plugin-migrate-localstorage](https://github.com/jairemix/cordova-plugin-migrate-localstorage) and updated the new location of localstorage based on my findings while inspection this. The tip is to uncomment the NSLog which logs file-location, and then in terminal on your mac open those in finder with the open command:
   
   `
   $ open /User/xx/...
   `
   
   You will then be able to find those files and adjust the files after your need. Mine was to change this line
   
   ```
   #define TARGET_LS_FILEPATH @"WebKit/WebsiteData/LocalStorage/http_localhost_8080.localstorage"
   ```
   
   to this:
   
   ```
   #define TARGET_LS_FILEPATH @"WebKit/WebsiteData/LocalStorage/app_localhost_0.localstorage"
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org