WKWebView reload() 无法刷新当前页面
WKWebView reload() can't refresh current page
第一次离线加载网页失败。
然后我连接网络调用 reload()
来刷新当前页面,但是它不起作用,WKNavigationDelegate
无法获得任何回调。
函数reloadFromOrigin()
也不行
但是文档说:
/*! @abstract Reloads the current page.
@result A new navigation representing the reload.
*/
- (nullable WKNavigation *)reload;
/*! @abstract Reloads the current page, performing end-to-end revalidation
using cache-validating conditionals if possible.
@result A new navigation representing the reload.
*/
- (nullable WKNavigation *)reloadFromOrigin;
谁能帮忙
第一次离线加载网页失败。那么webview.url就是nil
。试试下面的代码:
func reloadButtonDidTap() {
if webview.url != nil {
webview.reload()
} else {
webview.load(URLRequest(url: originalURL))
}
}
第一次离线加载网页失败。
然后我连接网络调用 reload()
来刷新当前页面,但是它不起作用,WKNavigationDelegate
无法获得任何回调。
函数reloadFromOrigin()
也不行
但是文档说:
/*! @abstract Reloads the current page.
@result A new navigation representing the reload.
*/
- (nullable WKNavigation *)reload;
/*! @abstract Reloads the current page, performing end-to-end revalidation
using cache-validating conditionals if possible.
@result A new navigation representing the reload.
*/
- (nullable WKNavigation *)reloadFromOrigin;
谁能帮忙
第一次离线加载网页失败。那么webview.url就是nil
。试试下面的代码:
func reloadButtonDidTap() {
if webview.url != nil {
webview.reload()
} else {
webview.load(URLRequest(url: originalURL))
}
}