practicalmeteor / meteor-wkwebview

A meteor package for using the significantly better and faster WKWebView in mobile apps on iOS 8+.
https://atmospherejs.com/practicalmeteor/wkwebview
MIT License
35 stars 4 forks source link

No session and user gets logged out after hot code reload #4

Open nerdmed opened 9 years ago

nerdmed commented 9 years ago

Hey @rbabayoff,

first thanks providing this package. The WKWebView is somehow essential for newer hybrid apps. However we noticed, that a hot code reload causes the user to get logged out and also deletes the session. I have tested it without your changes to the autoupdater and the package and it works.

Do have any experience with this issue or any solution?

Best, Med

Wenape commented 9 years ago

I've noticed the wkwebview doesn't like too many hot code pushes when running an app. In my case, about 2 hot code pushes would cause the app to eventually crash (usually triggered when backgrounding or resuming the app, with a memory error).

nerdmed commented 9 years ago

@Wenape yes i have also experienced this, any experience on the user account stuff?

rbabayoff commented 9 years ago

ios, right? which version of ios and are you running safari in private mode?

nerdmed commented 9 years ago

Hey @rbabayoff, we are running on ios 8.3 - never changed something to the safari settings

rbabayoff commented 9 years ago

I know. I thought it might be that safari and wkwebview share the same private mode setting, and in private mode you cannot access localStorage, which is what meteor relies on to re-login automatically after a hot code push, to my understanding.

rbabayoff commented 9 years ago

In our use case, we use mdg:reload-on-resume, in order to avoid hot code pushes while the app is running, so this can be a workaround, for now. Just note that the Telerik wkwebview cordova plugin that this package depends on is a temporary workaround, until cordova officially supports it, so I do expect issues with it and would recommend just to notify the user that there is a new version and to restart the app. You can do it by using the following event from the meteor reload package:

Reload._onMigrate

Look at the meteor source code for documentation about it.

nerdmed commented 9 years ago

Ok i will check on the private mode of safari. Using reload on resume and logging in afterwards seems like the way to go for now.

rbabayoff commented 9 years ago

Sorry, got confused. To know if there is a new version, the reload-on-resume package has a reactive data source:

Reload.isWaitingForResume()

rbabayoff commented 9 years ago

See readme here:

https://github.com/meteor/mobile-packages/blob/master/packages/mdg:reload-on-resume/README.md

nerdmed commented 9 years ago

thanks a lot for sharing!

ephemer commented 9 years ago

@rbabayoff please see https://github.com/Telerik-Verified-Plugins/WKWebView/issues/104, especially the rundown in my comment at the bottom.

Essentially, if one turns off the crash detection (As I argued in the other thread, it really should be off be default), there should be no more issues with hot code reload or with local storage. See the latest commits in Telerik's repo for the option to disable crash detection.

It'd be great if you could merge these commits into your fork (or just comment out _crashRecoveryTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(recoverFromCrash) userInfo:nil repeats:YES]; in MyMainViewController.m)

rbabayoff commented 9 years ago

Will do. Give me a couple of days. I also want to eliminate the need to add the cordova plugin before adding this package, since apparently the meteor bug that prevented me to do so disappeared.

rbabayoff commented 9 years ago

Hey, I'm having build problems on iOS merging the latest telerik changes, due to them extracting the web server to a separate package. If you know Objectve C, help will be appreciated. Don't really have the time now to learn the depths of a new language and dig into xCode debugging.