小程序拨打电话api报错makePhoneCall:fail cancel

源代码

   wx.makePhoneCall({
      phoneNumber: app.globalData.phoneNumber,
    })

  

 

只需要在后面加上catch就可以解决这个报错

    wx.makePhoneCall({
      phoneNumber:app.globalData.phoneNumber,
    }).catch((e) => {
      // console.log(e)  //用catch(e)来捕获错误{makePhoneCall:fail cancel}
    })

  

原文地址:https://www.cnblogs.com/zhangyouwu/p/14716932.html