• <small id='kozHO'></small><noframes id='kozHO'>

      <bdo id='kozHO'></bdo><ul id='kozHO'></ul>
    <legend id='kozHO'><style id='kozHO'><dir id='kozHO'><q id='kozHO'></q></dir></style></legend>

      <tfoot id='kozHO'></tfoot>

      1. <i id='kozHO'><tr id='kozHO'><dt id='kozHO'><q id='kozHO'><span id='kozHO'><b id='kozHO'><form id='kozHO'><ins id='kozHO'></ins><ul id='kozHO'></ul><sub id='kozHO'></sub></form><legend id='kozHO'></legend><bdo id='kozHO'><pre id='kozHO'><center id='kozHO'></center></pre></bdo></b><th id='kozHO'></th></span></q></dt></tr></i><div id='kozHO'><tfoot id='kozHO'></tfoot><dl id='kozHO'><fieldset id='kozHO'></fieldset></dl></div>

        通用链接不适用于 WKWebView

        Universal links not working with WKWebView(通用链接不适用于 WKWebView)

        <small id='RleSs'></small><noframes id='RleSs'>

            <bdo id='RleSs'></bdo><ul id='RleSs'></ul>

          • <legend id='RleSs'><style id='RleSs'><dir id='RleSs'><q id='RleSs'></q></dir></style></legend>
            <i id='RleSs'><tr id='RleSs'><dt id='RleSs'><q id='RleSs'><span id='RleSs'><b id='RleSs'><form id='RleSs'><ins id='RleSs'></ins><ul id='RleSs'></ul><sub id='RleSs'></sub></form><legend id='RleSs'></legend><bdo id='RleSs'><pre id='RleSs'><center id='RleSs'></center></pre></bdo></b><th id='RleSs'></th></span></q></dt></tr></i><div id='RleSs'><tfoot id='RleSs'></tfoot><dl id='RleSs'><fieldset id='RleSs'></fieldset></dl></div>

                <tbody id='RleSs'></tbody>
              <tfoot id='RleSs'></tfoot>
                  本文介绍了通用链接不适用于 WKWebView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在公司有基于 web-view 的应用程序和其他本地应用程序.我们在需要时使用 universal links 将用户重定向到其他应用程序(其他应用程序仍然支持 universal links - 我可以通过按 Apple Notes 应用程序).我们最近过渡到 WKWebView(来自 UIWebView),它提供了更好的体验.但是更新后 Universal Links 停止工作,当用户在我们的应用程序中按下链接时,我们无法启动其他应用程序.

                  I have web-view based app and other native apps in company. We were using universal links to redirect user to other apps when needed (other apps still support universal links - I can run them by pressing links from Apple Notes app). We recently made a transition to WKWebView (from UIWebView), which provides a way better experience. But after the update Universal Links stopped working and we cannot start other apps when user press link inside our app.

                  根据文档:

                  通用链接让 iOS 9 用户在点击链接时打开您的应用程序您的网站在 WKWebView 和 UIWebView 视图和 Safari 页面中,在除了导致调用 openURL: 的链接,例如那些发生在邮件、信息和其他应用程序中."

                  "Universal links let iOS 9 users open your app when they tap links to your website within WKWebView and UIWebView views and Safari pages, in addition to links that result in a call to openURL:, such as those that occur in Mail, Messages, and other apps."

                  来源:https://developer.apple.com/library/ios/documentation/General/Conceptual/AppSearch/UniversalLinks.html

                  WKWebView 似乎没有处理 Universal Links.我的问题是,我是否缺少 WKWebView 的一些特殊配置,或者这是 WebKit 错误?我正在按照提供的方式创建 Web 视图:

                  It seems that WKWebView is not handling the Universal Links. My questions is, am I missing some special configuration for WKWebView or this is WebKit bug? I'm creating web view as provided:

                  WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc] init];  
                  config.allowsInlineMediaPlayback = YES;  
                  config.processPool = // Here I'm using shared process pool  
                  
                  self.webView = [[WKWebView alloc] initWithFrame:CGRectZero configuration:config];  
                  self.webView.translatesAutoresizingMaskIntoConstraints = NO;  
                  self.webView.clipsToBounds = YES;  
                  self.webView.allowsBackForwardNavigationGestures = YES;  
                  
                  if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"9.0")) {  
                    self.webView.allowsLinkPreview = YES;  
                  }  
                  [self addSubview:_webView];
                  

                  为了显示问题,我使用简单的应用程序创建了简单的存储库(https://github.com/apan06/UniversalLinks - 非常简单的初始化).有两个 web 视图 - WKWebViewUIWebView,两者都带有简单的 html,只有 Twitter 的链接.WKWebView 只是加载 Twitter 页面.另一方面 UIWebView 打开 Twitter 应用程序.请记住:- 在安装了 Twitter 应用程序的设备上测试它,如果您没有 Twitter 应用程序 或不喜欢 Twitter,您可以更改链接- 我在 iPhone 6 上用 iOS 9.2.1

                  To show the problem I have created simple repository with simple app (https://github.com/apan06/UniversalLinks - with very simple initialisation). There are two web views - WKWebView and UIWebView with both with simple html that there is only link to Twitter. WKWebView simply loads the Twitter page. On the other hand UIWebView open Twitter app. Just remembet: - test it on device with Twitter app installed, if you don't have Twitter app or don't like Twitter you can change link - I was testing it on iPhone 6 with iOS 9.2.1

                  谢谢!

                  推荐答案

                  我认为 WKWebView 中存在一个错误,如果未设置导航委托,它会忽略通用链接.尝试设置 WKWebView 的导航委托.您不必实现任何委托方法.

                  I believe there is a bug in WKWebView that makes it ignore universal links if the navigation delegate is not set. Try setting the WKWebView’s navigation delegate. You don’t have to implement any of the delegate methods.

                  这篇关于通用链接不适用于 WKWebView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  iOS UIWebView app opens link in Safari(iOS UIWebView 应用在 Safari 中打开链接)
                  Close UIWebView using javascript:window.close();(使用 javascript:window.close() 关闭 UIWebView;)
                  NSCachedURLResponse returns object, but UIWebView does not interprets content(NSCachedURLResponse 返回对象,但 UIWebView 不解释内容)
                  Trouble hiding iAd banner and displaying UIWebView in its place(无法隐藏 iAd 横幅并在其位置显示 UIWebView)
                  Knowing when AJAX has loaded in UIWebView(知道何时在 UIWebView 中加载了 AJAX)
                  Load image/logo in existing HTML input field - UIWebView(在现有的 HTML 输入字段中加载图像/徽标 - UIWebView)

                    1. <small id='sXngn'></small><noframes id='sXngn'>

                        <tbody id='sXngn'></tbody>

                      <legend id='sXngn'><style id='sXngn'><dir id='sXngn'><q id='sXngn'></q></dir></style></legend>
                      • <i id='sXngn'><tr id='sXngn'><dt id='sXngn'><q id='sXngn'><span id='sXngn'><b id='sXngn'><form id='sXngn'><ins id='sXngn'></ins><ul id='sXngn'></ul><sub id='sXngn'></sub></form><legend id='sXngn'></legend><bdo id='sXngn'><pre id='sXngn'><center id='sXngn'></center></pre></bdo></b><th id='sXngn'></th></span></q></dt></tr></i><div id='sXngn'><tfoot id='sXngn'></tfoot><dl id='sXngn'><fieldset id='sXngn'></fieldset></dl></div>

                          <bdo id='sXngn'></bdo><ul id='sXngn'></ul>
                          <tfoot id='sXngn'></tfoot>