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/06/18 08:42:50 UTC

[GitHub] [cordova-ios] seamlink-aalves opened a new issue #906: Migration of local storage

seamlink-aalves opened a new issue #906:
URL: https://github.com/apache/cordova-ios/issues/906


   I've started testing cordova-ios 6.0.0 and I haven't found a way to migrate local storage and indexDB data.
   
   In version 5.1.1 of cordova-ios I was using cordova-plugin-wkwebview-engine and cordova-plugin-wkwebview-file-xhr which I removed when upgrading to 6.0.0. But with the introduction of scheme and hostname preferences to solve the CORS issue I lose previous localstorage and IndexDB.
   
   Is anyone facing this issue or found a way to solve this?
   
   


----------------------------------------------------------------
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


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

Posted by GitBox <gi...@apache.org>.
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


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

Posted by GitBox <gi...@apache.org>.
gerhardsletten edited a comment on issue #906:
URL: https://github.com/apache/cordova-ios/issues/906#issuecomment-674835241


   @jcesarmobile yes, I ment migration from cordova-ios-5.x and UIWebView directly to cordova-ios-6 and WKWebView, so then as you say, localstorage will not be migrated for you and you will need to fix this yourself.


----------------------------------------------------------------
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


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

Posted by GitBox <gi...@apache.org>.
gerhardsletten commented 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 comman d:
   
   `
   $ 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


[GitHub] [cordova-ios] Viglino commented on issue #906: Migration of local storage

Posted by GitBox <gi...@apache.org>.
Viglino commented on issue #906:
URL: https://github.com/apache/cordova-ios/issues/906#issuecomment-717327789


   I've implemented @gerhardsletten solution to use with **regular cordova app** ios-6.x with `app` scheme here: https://github.com/Viglino/cordova-plugin-migrate-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


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

Posted by GitBox <gi...@apache.org>.
gerhardsletten commented on issue #906:
URL: https://github.com/apache/cordova-ios/issues/906#issuecomment-674835241


   @jcesarmobile yes, I ment migration from UIWebView directly to cordova-ios-6 and WKWebView, so then as you say, localstorage will not be migrated for you and you will need to fix this yourself.


----------------------------------------------------------------
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


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

Posted by GitBox <gi...@apache.org>.
jcesarmobile edited a comment on issue #906:
URL: https://github.com/apache/cordova-ios/issues/906#issuecomment-646052957


   We don't plan to migrate user's data, that's up to you if you want to migrate it or not. 
   
   You can keep using file protocol if you don't configure the scheme and your data will still be there (if you were already using a WKWebView plugin). If you set the scheme then data won't be accessible as the url changes (not lost, the data is still there). 
   
   Here are some plugins that do data migration (the linked plugin is one of them, but included other plugins in which its based that can also help you migrating the data)
   https://github.com/kassamina/cordova-plugin-ionic-migrate-storage#thanks


----------------------------------------------------------------
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


[GitHub] [cordova-ios] jcesarmobile commented on issue #906: Migration of local storage

Posted by GitBox <gi...@apache.org>.
jcesarmobile commented on issue #906:
URL: https://github.com/apache/cordova-ios/issues/906#issuecomment-674837568


   Updated my original comment to make clear it only applies if already using WKWebView as the reporter was doing.


----------------------------------------------------------------
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


[GitHub] [cordova-ios] mushishi78 commented on issue #906: Migration of local storage

Posted by GitBox <gi...@apache.org>.
mushishi78 commented on issue #906:
URL: https://github.com/apache/cordova-ios/issues/906#issuecomment-717127441


   I also appreciated the above comment from @gerhardsletten. I ended up needing more changes to get it to work for me, so my fork is here if it helps anyone: https://github.com/mushishi78/cordova-plugin-migrate-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


[GitHub] [cordova-ios] jcesarmobile commented on issue #906: Migration of local storage

Posted by GitBox <gi...@apache.org>.
jcesarmobile commented on issue #906:
URL: https://github.com/apache/cordova-ios/issues/906#issuecomment-674828080


   I don't see how what you say conflicts whit what I said.
   
   I say, if you were using cordova-plugin-wkwebview-engine plugin and move to cordova-ios 6, the data will still be there if you use file protocol. 
   If you configure the app to use a scheme and hostname, then the data won't be accessible from the app (but not lost).
   
   If you were using UIWebView, then yeah, the data won't be accessible even if using file protocol because they are different WebViews.
   If migrating from UIWebView to WKWebView or moving from file to a custom scheme, users that want to migrate their data will need to use some plugin like the one you mentioned.


----------------------------------------------------------------
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


[GitHub] [cordova-ios] jcesarmobile commented on issue #906: Migration of local storage

Posted by GitBox <gi...@apache.org>.
jcesarmobile commented on issue #906:
URL: https://github.com/apache/cordova-ios/issues/906#issuecomment-646052957


   We don't plan to migrate user's data, that's up to you if you want to migrate it or not. 
   
   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). 
   
   Here are some plugins that do data migration (the linked plugin is one of them, but included other plugins in which its based that can also help you migrating the data)
   https://github.com/kassamina/cordova-plugin-ionic-migrate-storage#thanks


----------------------------------------------------------------
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


[GitHub] [cordova-ios] jcesarmobile closed issue #906: Migration of local storage

Posted by GitBox <gi...@apache.org>.
jcesarmobile closed issue #906:
URL: https://github.com/apache/cordova-ios/issues/906


   


----------------------------------------------------------------
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


[GitHub] [cordova-ios] SuneRadich commented on issue #906: Migration of local storage

Posted by GitBox <gi...@apache.org>.
SuneRadich commented on issue #906:
URL: https://github.com/apache/cordova-ios/issues/906#issuecomment-703636044


   > @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 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"
   > ```
   
   Not wanting to ressurrect an old issue, but I just wanted to say that following the above overall guide, I was able to migrate localStorage from UIWebView to WKWebView when we updated to the latest `platform-ios`.


----------------------------------------------------------------
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