iOS Simulator WebView投掷“超时”发生了。

发布于 2025-01-22 07:12:56 字数 1517 浏览 4 评论 0原文

我正在执行一个简单的移动应用程序,该应用程序嵌入wkwebview使用ionic 6 + angular

我已经在MacBook上使用Chrome和Safari测试了我的网站,一切都很好,直到我在wkwebview控制上打开它。

首先,我的WebView成功显示(如下图)

”在此处输入图像说明”

当我单击提交按钮时,我的ionic 6网站将调用API端点&继续下载一些块,然后转到下一页。

但是,这是我在提交按钮之后得到的:

“在此处输入图像说明”

错误消息是:

[Error] ERROR
Object

info: {meta: null, lastValue: null, seen: 0}

message: "Timeout has occurred"

name: "TimeoutError"

stack: "@http://****/main.02dd4c6bece51f6f.js:1:175858↵@http://****/main.02dd4c6bece51f6f.js:1:43982…"


这是我设置我的WebView的方式:

 func setupWebView() {
        let url = URL(string: "http://<my-end-point>/")!
        let request: URLRequest = URLRequest(url: url, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 180)
        webView.load(request)
    
        webView.allowsBackForwardNavigationGestures = true
        webView.configuration.userContentController.add(self, name: listenerName)
    }

我的问题是:

  • 我可以增加wkwebview的超时到通过此问题?
  • 我还没有将应用程序部署到物理设备上,是模拟器的问题吗?还是物理设备问题?

I'm doing a simple mobile application which embeds a WkWebView to display my website using Ionic 6 + Angular.

I have tested my website with Chrome and Safari on Macbook, everything was fine until I opened it on my WKWebView control.

At first, my webview displayed successfully (as the below image)

enter image description here

When I clicked Submit button, my Ionic 6 website would call an API Endpoint & continued download some chunks and go to the next page.

However, this is what I got after Submit button has been clicked:

enter image description here

The error message was:

[Error] ERROR
Object

info: {meta: null, lastValue: null, seen: 0}

message: "Timeout has occurred"

name: "TimeoutError"

stack: "@http://****/main.02dd4c6bece51f6f.js:1:175858↵@http://****/main.02dd4c6bece51f6f.js:1:43982…"


This is how I setup my webview:

 func setupWebView() {
        let url = URL(string: "http://<my-end-point>/")!
        let request: URLRequest = URLRequest(url: url, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 180)
        webView.load(request)
    
        webView.allowsBackForwardNavigationGestures = true
        webView.configuration.userContentController.add(self, name: listenerName)
    }

My question is:

  • Can I increase the timeout of WKWebView to by pass this issue ?
  • I haven't deployed my app onto physical device, is it an issue of simulator only ? or it is physical device issue also ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文