ios - Url 在 UIWebView 和 WKWebView 之间停止加载。仅在 iOS 11 上
<p><p>我的网址</p>
<ul>
<li> <a href="https://app.educationgalaxy.com/games/ipadgame.html?retries=3&name=blastoff&rocket=3&level=2&score=0&gameTimer=150" rel="noreferrer noopener nofollow">https://app.educationgalaxy.com/games/ipadgame.html?retries=3&name=blastoff&rocket=3&level=2&score=0&gameTimer=150</a> </li>
</ul>
<p>我的发现</p>
<ul>
<li><p>该 URL 可与所有 safari 和其他浏览器完美配合。
(包括 iOS 11 移动版 Safari)</p></li>
<li><p>该网址适用于除 iOS 11 以外的所有 iOS 版本。</p></li>
<li><p>我尝试在 UIWebView 和 WKWebView 上打开 URL,但同样的问题发生在两者上。即 URL 在接近完成时停止加载,并且
然后什么都不会发生。</p></li>
</ul>
<p>这是我目前尝试过的</p>
<pre><code>import UIKit
import WebKit
class ViewController: UIViewController, WKNavigationDelegate {
// Objects
var webView: WKWebView!
override func viewDidLoad() {
super.viewDidLoad()
setupWebView()
loadUrl()
}
func setupWebView() {
let prefs = WKPreferences()
prefs.javaScriptEnabled = true
let config = WKWebViewConfiguration()
config.preferences = prefs
webView = WKWebView(frame: view.frame, configuration: config)
webView.navigationDelegate = self
view.addSubview(webView)
}
func loadUrl() {
webView.navigationDelegate = self
let url = URL(string: "https://app.educationgalaxy.com/games/ipadgame.html?retries=3&name=blastoff&rocket=3&level=2&score=0&gameTimer=150")!
var request = URLRequest(url: url)
request.cachePolicy = .reloadRevalidatingCacheData
webView.load(request)
}
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
print(webView.url!)
}
func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
print(webView.url!)
}
func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) {
print("error- \(error)")
}
}
</code></pre>
<p>感谢您的帮助。</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>WkWebview 是最近引入的,UIWebView 现已正式弃用。
这是苹果论坛上发布的同一问题的链接。苹果工作人员目前正在解决崩溃问题。
<a href="https://forums.developer.apple.com/thread/90411" rel="noreferrer noopener nofollow">enter link description here</a> </p>
<p> <a href="https://forums.developer.apple.com/thread/90411" rel="noreferrer noopener nofollow">https://forums.developer.apple.com/thread/90411</a>
还尝试在您的项目中添加 WKWebView.framework。
和运输安全。
希望这些信息对您有所帮助。</p></p>
<p style="font-size: 20px;">关于ios - Url 在 UIWebView 和 WKWebView 之间停止加载。仅在 iOS 11 上,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/47526829/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/47526829/
</a>
</p>
页:
[1]