收藏
回答

web-view jssdk调用扫一扫功能,安卓可以调用成功,ios不行,点击没反应,是为什么?

web-view JSSDK,扫一扫功能不支持ios吗?怎么解决。试了好几部手机

回答关注问题邀请回答
收藏

5 个回答

  • nini
    nini
    2021-12-15

    解决了吗?我也遇到了

    2021-12-15
    有用
    回复
  • Lara ʚɞ
    Lara ʚɞ
    发表于移动端
    2021-01-05
    我们也遇到这个问题,后来查到是iOS路由机制问题,对于SPA应用来说,有扫描的页面都要用location herf跳转,不能用内置router跳。包括微信map接口也是
    2021-01-05
    有用
    回复
  • 2020-09-23

    同样的问题,有哪位解决了吗

    2020-09-23
    有用
    回复
  •  
     
    2020-07-20

    我这里也是 安卓扫一扫能成功打印返回值和弹出框,IOS就不行,请问是什么原因》?


    2020-07-20
    有用
    回复
  • 灵芝
    灵芝
    2020-05-08

    你好,麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

    2020-05-08
    有用
    回复 12
    • Soulmate。 
      Soulmate。 
      2020-05-08
      微信 7.0.12 iphone11 系统版本13.11
      2020-05-08
      回复
    • Soulmate。 
      Soulmate。 
      2020-05-08
      <!DOCTYPE html>
      <html lang="en">


      <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
        <script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
        <script src="./static/js/jquery.min.js"></script>
        <script type="text/javascript" src="https://unpkg.com/soonspacejs/dist/index.js"></script>
        <script type="text/javascript" src="https://unpkg.com/vconsole/dist/vconsole.min.js"></script>
      </head>
      <style>
        body {
          margin: 0;
        }


        #view {
          width: 100vw;
          height: 100vh;
          position: relative;
          /* top: 100px; */
        }


        .fixed-position {
          width: 290px;
          height: 58px;
          background-color: rgba(0, 0, 0, 0.3);
          margin-left: 13px;
          position: absolute;
          top: 10px;
          z-index: 10;
        }


        .parking-position input {
          width: 200px;
          outline: none;
          margin-left: 6px;
          margin-top: 5px;
          background-color: rgba(0, 0, 0, 0.7);
          border: 1px solid #ffffff;
          border-radius: 5px;
        }


        .parking-position button {
          background-color: #ffff;
          outline: none;
          border-radius: 5px;


        }


        input::-webkit-input-placeholder,
        textarea::-webkit-input-placeholder {
          color: #ffff;
        }
      </style>


      <body>
        <div id="view">
          <div class="fixed-position">
            <div class="parking-position">
              <input type="text" placeholder="车位位置">
              <button onclick="scanningCode()">扫码录入</button>
            </div>
            <div class="parking-position">
              <input type="text" placeholder="当前位置">
              <button onclick="scanningCode()">扫码录入</button>
            </div>
          </div>
        </div>


      </body>
      <script type="text/javascript">
        const vConsole = new VConsole();
        $.ajax({
          url: 'http://192.168.0.147:8880/wxapi/getJsapiSignature',
          dataType: 'json',
          type: "post",
          contentType: "application/x-www-form-urlencoded",
          data: {
            url: window.location.href.split('#')[0]
          },
          success: (data) => {
            wx.config({
              debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
              appId: data.appId, // 必填,公众号的唯一标识
              timestamp: data.timestamp, // 必填,生成签名的时间戳
              nonceStr: data.nonceStr, // 必填,生成签名的随机串
              signature: data.signature,// 必填,签名,见附录1
              jsApiList: ['scanQRCode']//当前html需要用到的接口
            });
            wx.ready(function () {


              // config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。
            });
            wx.error(function (res) {
              // config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
            });
            wx.checkJsApi({
              jsApiList: ['scanQRCode'],// 需要检测的JS接口列表,所有JS接口列表见附录2,
              success: function (res) {
                // 以键值对的形式返回,可用的api值true,不可用为false
                // 如:{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
              }
            });


          }
        })


        const ssp = new SoonSpace({
          el: '#view',
          option: {
            showInfo: true
          },
          events: {}
        })


        const baseUrl = './static/model/xunwei'
        const mapsUrl = `${baseUrl}/Maps/`


        const sbmsInfo = [
          {
            id: 'B1',
            name: 'B1',
            url: `${baseUrl}/xunwei_1F_0.sbm`,
            mapsUrl,
            level: 800000
          }
        ]


        ssp.loadSbm(sbmsInfo)
          .then(list => {
            ssp.flyToObj(list[0])
          })
        function scanningCode() {
          setTimeout(() => {
            wx.scanQRCode({
              desc: 'scanQRCode desc',
              needResult: 0, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
              scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码,默认二者都有
              success: function (res) {
                console.log('aa')
                console.log(res)
                // 回调
              },
              error: function (res) {
                if (res.errMsg.indexOf('function_not_exist') > 0) {
                  alert('版本过低请升级')
                }
              }
            });
          }, 500)


        }


      </script>


      </html>
      2020-05-08
      回复
    • Soulmate。 
      Soulmate。 
      2020-05-08
      <web-view src="https://www.xwbuilders.com/sanweidaohang/index.html"></web-view>
      2020-05-08
      回复
    • 灵芝
      灵芝
      2020-05-08回复Soulmate。 
      直接微信浏览器打开也无法正常使用,直接打印error的信息看下呢
      2020-05-08
      回复
    • Soulmate。 
      Soulmate。 
      2020-05-09回复灵芝
      安卓是可以扫描成功的。
      2020-05-09
      回复
    查看更多(7)
登录 后发表内容
问题标签