小编Car*_*oni的帖子

WkWebView不会加载HTML字符串

我试图在WkWebView中显示我之前下载并存储在String中的html页面.

这就是我设置WkWebView的方法:

    webView = WKWebView(frame: self.blankView.frame)
    webView.navigationDelegate = self
    webView.loadHTMLString(tipShow.htmlString!, baseURL: nil)
    view.addSubview(webView)
Run Code Online (Sandbox Code Playgroud)

我想要显示的html字符串是:

      <html> <style type="text/css"> * { -webkit-touch-callout: none; -webkit-user-select: none; /*
  Disable selection/copy in UIWebView */
     }
   </style> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,
 initial-scale=1">

<title>TITLE</title>

 <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.css">
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> <script
    src="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"></script> </head>

  <body>




<div data-role="page" id="page1">

    <div align=justify style="margin-left:20px; margin-right:20px">

        <font size="4.5" face="HelveticaNeue-Light"><br>

        <p>
THIS IS A TEST
   </p>
</div> </div>

</body></html>
Run Code Online (Sandbox Code Playgroud)

当WkWebView在我的视图中显示时,它就像这样永远.

在此输入图像描述

有人可以解释一下为什么以及如何解决这个问题?

iphone ios swift wkwebview ios9

10
推荐指数
2
解决办法
1万
查看次数

地理编码 API 和 DialogFlow 意图获取“错误:没有为平台定义响应:空”

我正在尝试在对话流的填充中使用来自 Google 的地理编码 API。

详细说明:我希望用户给我他的地址并找到经纬度。

我从官方 github 存储库的 README 中获取了这段代码:

 googleMapsClient.geocode({address: '1600 Amphitheatre Parkway, Mountain View, CA'})
  .asPromise()
  .then((response) => {
    console.log(response.json.results);
  })
  .catch((err) => {
    console.log(err);
  });
Run Code Online (Sandbox Code Playgroud)

并以这种方式在我的意图处理程序中使用它:

    function findAddress(agent){
    var intent = new Intent(agent);
    parametersCustom.address = agent.parameters.address+', '+agent.parameters["geo-city"];
    agent = intent.finalSetup();
    return googleMapsClient.geocode({address: parametersCustom.address}).asPromise()
    .then((response) => {
      console.log(response.json.results[0].geometry.location);
    })
    .catch((err) => {
      console.log(err);
    });
}
Run Code Online (Sandbox Code Playgroud)

但是当我在 DialogFlow 的内联编辑器上运行它时,我收到了这个错误:

Error: No responses defined for platform: null
    at V2Agent.sendResponses_ (/srv/node_modules/dialogflow-fulfillment/src/v2-agent.js:243:13)
    at WebhookClient.send_ (/srv/node_modules/dialogflow-fulfillment/src/dialogflow-fulfillment.js:505:17)
    at promise.then (/srv/node_modules/dialogflow-fulfillment/src/dialogflow-fulfillment.js:316:38)
    at <anonymous>
    at process._tickDomainCallback …
Run Code Online (Sandbox Code Playgroud)

javascript geocoding geolocation google-geocoding-api dialogflow-es

4
推荐指数
1
解决办法
234
查看次数

从NSMutableString中删除括号

我有一个像这样的NSMutableString:

(
    993,
    12836,
    10630
)
Run Code Online (Sandbox Code Playgroud)

我怎样才能删除括号?

编辑

字符串是此指令的结果:

NSMutableString * result = [labelpost description];
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ios

-2
推荐指数
1
解决办法
519
查看次数