WKWebView contextMenuConfigurationForElement 方法不提供提供的操作

问题描述 投票:0回答:0

我已经看到一些与

present(_:animated:completion:)
相关的崩溃不是从主线程调用的,所以我将它移动到我的基本视图控制器类中的主异步块中,就像这样

    override func present(_ viewControllerToPresent: UIViewController, animated flag: Bool, completion: (() -> Void)? = nil) {
        DispatchQueue.main.async {
            super.present(viewControllerToPresent, animated: flag, completion: completion)
        }
    }

我也有

webView(_:contextMenuConfigurationForElement:completionHandler:)
呈现上下文菜单的方法。

在我将 present 方法移至主异步后,

WKWebView
现在不显示上下文菜单。 相反,它呈现一个覆盖整个屏幕的暗淡透明(不模糊)视图,不包含菜单,我可以向下滑动以关闭它。

如果我从基类中删除主异步块,上下文菜单将按预期显示。

这里有什么问题,我该如何解决?

ios uikit wkwebview uimenu
© www.soinside.com 2019 - 2024. All rights reserved.