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

        • <bdo id='hnEhx'></bdo><ul id='hnEhx'></ul>
      1. <small id='hnEhx'></small><noframes id='hnEhx'>

        WKWebView 在设备上显示空白,在模拟器上工作

        WKWebView showing blank on device, working on simulator(WKWebView 在设备上显示空白,在模拟器上工作)

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

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

                  本文介绍了WKWebView 在设备上显示空白,在模拟器上工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我的应用程序的模块之一是网站.该网站主要包含一个 SVG 绘图,带有自定义形状的按钮(使用 Raphael.js 库)来访问其他绘图(其他带有 svg 绘图的 html 页面).

                  One of the modules of my app is a web site. That web site contains primarily an SVG drawing, with custom shaped buttons (using Raphael.js library) to access other drawings (other html page with svg drawings).

                  如果设备在 iOS 7 上,我使用 UIWebView,一切正常.

                  If the device is on iOS 7, I use a UIWebView and everything works fine.

                  对于 iOS 8 设备,我使用 WKWebView.我遇到了一些问题,其中一些已通过这篇文章解决.我可以在这些模拟器(iPhone 5/iOS 8.0 (12A365) 和 iPhone 5s/iOS 8.0)上看到我的网站,但在我的 iPod Touch(第 5 代,运行 iOS 8.0.2)上看不到它.它显示一个空白屏幕.

                  For iOS 8 devices, I use a WKWebView. I had some issues, some of them resolved by this post. I can see my web site on those simulators (iPhone 5 / iOS 8.0 (12A365) & iPhone 5s / iOS 8.0), but I can't see it on my iPod Touch (5th gen, running iOS 8.0.2). It shows a blank screen.

                  我不知道要寻找什么.有什么想法吗?

                  I don't know what to look for. Any idea?

                  编辑

                  在遵循@Dan Fabulich 的回答(此处)之后,我现在得到了一个永远加载的 web 视图,它永远不会完成加载向上.他的回答告诉我们,从字符串加载 html 时 WKWebView 存在错误.他的回答是将 html 内容复制到一个新的子文件夹中,然后从该 URL 调用 loadRequest.

                  After following @Dan Fabulich's answer (here), I now get a forever-loading webview, that never finishes loading up. His answer tells us that there is a bug with WKWebView when loading html from a string. His answer is to copy the html content into a new subfolder and then call loadRequest from that URL.

                  不幸的是,我仍然无法正常工作.有什么线索吗?webview 永远无法完成加载内容的原因是什么?

                  Unfortunately, I'm still stuck with a non-working webview. Any clue? What would be a reason for a webview to never finish loading up content?

                  推荐答案

                  我遇到了一些问题,但我解决了配置选项的问题.这是我的代码.

                  i had some problem but i solved problem with configuration options. here is my my code.

                      var a = dic["adi"]?.asString()
                      var path = NSBundle.mainBundle().pathForResource(a, ofType: "htm" )
                      var url = NSURL(fileURLWithPath:path!)
                      var request = NSURLRequest(URL:url!)
                  
                      var theConfiguration = WKWebViewConfiguration()
                  
                      theWebView = WKWebView(frame:self.view.frame, configuration: theConfiguration)
                  
                      var error:NSError?
                      let text2 = String(contentsOfFile: path!, encoding:NSUTF8StringEncoding, error: &error)
                  
                      if let theError = error
                      {
                          print("(theError.localizedDescription)")
                      }
                  
                      theWebView!.loadHTMLString(text2!, baseURL: nil)
                      self.view.addSubview(theWebView!)
                  

                  希望这会有所帮助.

                  这篇关于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)
                  <i id='zRT5W'><tr id='zRT5W'><dt id='zRT5W'><q id='zRT5W'><span id='zRT5W'><b id='zRT5W'><form id='zRT5W'><ins id='zRT5W'></ins><ul id='zRT5W'></ul><sub id='zRT5W'></sub></form><legend id='zRT5W'></legend><bdo id='zRT5W'><pre id='zRT5W'><center id='zRT5W'></center></pre></bdo></b><th id='zRT5W'></th></span></q></dt></tr></i><div id='zRT5W'><tfoot id='zRT5W'></tfoot><dl id='zRT5W'><fieldset id='zRT5W'></fieldset></dl></div>
                  • <bdo id='zRT5W'></bdo><ul id='zRT5W'></ul>

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

                        <tfoot id='zRT5W'></tfoot>

                            <tbody id='zRT5W'></tbody>
                        • <legend id='zRT5W'><style id='zRT5W'><dir id='zRT5W'><q id='zRT5W'></q></dir></style></legend>