<bdo id='9f6ml'></bdo><ul id='9f6ml'></ul>

      <small id='9f6ml'></small><noframes id='9f6ml'>

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

      1. <legend id='9f6ml'><style id='9f6ml'><dir id='9f6ml'><q id='9f6ml'></q></dir></style></legend>

        在 IOS 10 中使用 IFRAME 将数据从 javascript 传递到 Objective-c 时,在 shou

        getting about:blank in shouldStartLoadWithRequest while passing the data from javascript to objective-c using IFRAME in IOS 10(在 IOS 10 中使用 IFRAME 将数据从 javascript 传递到 Objective-c 时,在 shouldStartLoadWithRequest 中获取 about:bla
        <tfoot id='HootC'></tfoot>

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

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

                  <tbody id='HootC'></tbody>
                <legend id='HootC'><style id='HootC'><dir id='HootC'><q id='HootC'></q></dir></style></legend>
                  本文介绍了在 IOS 10 中使用 IFRAME 将数据从 javascript 传递到 Objective-c 时,在 shouldStartLoadWithRequest 中获取 about:blank的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在将我的数据从 javascript 传递到 Objective-c.为此,我正在使用 IFRAME.
                  这是我的代码:
                  context.html

                  I am passing my data from javascript to objective-c. for that I am using IFRAME.
                  Here is my code:
                  context.html

                  function openCustomURLinIFrame(src)
                  {
                      alert(src);
                      var rootElm = document.documentElement;
                      var newFrameElm = document.createElement("IFRAME");
                      newFrameElm.setAttribute("src",src);
                      document.documentElement.appendChild(newFrameElm);
                      //remove the frame now
                      newFrameElm.parentNode.removeChild(newFrameElm);
                      newFrameElm = null;
                  }  
                  

                  Indoor.m

                  - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
                  {
                      NSLog(@"Loading: %@", [request URL]);
                      NSURL *url = [request URL];
                      NSString *urlStr = url.absoluteString;
                  
                      return [self processURL:urlStr];
                  
                  }  
                  

                  我来了

                  加载中:about:blank

                  Loading: about:blank

                  我使用的是 xCode 8.2.1,它在 IOS 9.3 中运行良好,但在 iOS 10.2 中无法运行.

                  I am using xCode 8.2.1 it is working well in IOS 9.3 but not working in iOS 10.2.


                  我在 .html 文件中的警报屏幕截图.


                  My alert screenshot in .html file.


                  我在其中调用 openCustomURLinIFrame 方法的 html 文件中的方法.


                  Method in html file in which I call openCustomURLinIFrame method.

                  function calliOSFunction(functionName, args, successCallback, errorCallback)
                  {
                      var url = "js2ios://";
                      var callInfo = {};
                      callInfo.functionname = functionName;
                      //alert("Custom menu clicked !!"+functionName);
                      if (successCallback)
                      {
                          //alert("Success !!"+functionName);
                          callInfo.success = successCallback;
                      }
                      if (errorCallback)
                      {
                          //alert("Error !!"+functionName);
                          callInfo.error = errorCallback;
                      }
                      if (args)
                      {
                          //alert("args !!"+args);
                          callInfo.args = args;
                      } 
                      url += JSON.stringify(callInfo)   
                      openCustomURLinIFrame(url);
                  }
                  

                  帮我解决这个问题.

                  推荐答案

                  终于在很久之后得到了答案.

                  Finally after long time I got my answer.

                  function calliOSFunction(functionName, args, successCallback, errorCallback)
                  {
                      var url = "js2ios:///";   /* Added one more "/" */
                      var callInfo = {};
                      callInfo.functionname = functionName;
                      //alert("Custom menu clicked !!"+functionName);
                      if (successCallback)
                      {
                          //alert("Success !!"+functionName);
                          callInfo.success = successCallback;
                      }
                      if (errorCallback)
                      {
                          //alert("Error !!"+functionName);
                          callInfo.error = errorCallback;
                      }
                      if (args)
                      {
                          //alert("args !!"+args);
                          callInfo.args = args;
                      }
                  
                      url += JSON.stringify(callInfo)
                  
                      openCustomURLinIFrame(url);
                  }   
                  

                  我在 url 变量中再添加一个/".

                  I add one more "/" in url variable.

                  这篇关于在 IOS 10 中使用 IFRAME 将数据从 javascript 传递到 Objective-c 时,在 shouldStartLoadWithRequest 中获取 about:blank的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Hardware Volume buttons change in app volume(硬件音量按钮更改应用程序音量)
                  Cocos2d - How to check for Intersection between objects in different layers(Cocos2d - 如何检查不同层中对象之间的交集)
                  How to convert 32 bit PNG to RGB565?(如何将 32 位 PNG 转换为 RGB565?)
                  Proper cocos2d scene restart?(正确的 cocos2d 场景重启?)
                  Game center facebook like(游戏中心 facebook 喜欢)
                  Objective-C++ importing C++ class fails, cassert not found(Objective-C++ 导入 C++ 类失败,未找到 cassert)

                        <tbody id='EevFk'></tbody>

                          <bdo id='EevFk'></bdo><ul id='EevFk'></ul>
                        • <legend id='EevFk'><style id='EevFk'><dir id='EevFk'><q id='EevFk'></q></dir></style></legend>
                        • <tfoot id='EevFk'></tfoot>

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

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