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

WKWebView freezes when I start the Embassy http server #69

Open
josh83abc opened this issue Mar 1, 2019 · 1 comment
Open

WKWebView freezes when I start the Embassy http server #69

josh83abc opened this issue Mar 1, 2019 · 1 comment

Comments

@josh83abc
Copy link

Hi guys!

I'm an experienced developer but a beginner with Swift and iOS, so your help will be very valuable.
My iOS app is based on a WKWebView loading some HTML (hybrid app).

Since the WKWebView cant access to local files, I wanted to run a HTTP server on the iOS device and then use it from inside the WKWebView.

However, when I start the Embassy server like in your example, my WKWebView becomes unresponsive and completely frozen. If I start a safari outside the app, I do see that the HTTP server is working.
I also do see that it is the line "loop.runForever()" which freezes the webview.

How can I fix that? Maybe I missed something :)

Thanks a lot!!
Josh

@ChiChou
Copy link

ChiChou commented Dec 24, 2019

Don't use runForever in UI thread. You need DispatchQueue.global(qos: .background).async

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

No branches or pull requests

2 participants