downloadFile 非调试状态无法下载,调试状态下可下载
发布于 6 年前 作者 jie63 9606 次浏览 来自 问答

以下代码在真机下,非调试状态无法下载,一个提示都没有,调试状态下可下载,可提示

手机 华为V8, OPPO

在其他地方  有用到downloadFile  非调试状态都失败。。。

       wx.downloadFile({

         url: getApp().AppUrl + res.data.Data,

         success: function (res) {

           wx.showToast({

             title: ‘33’,

             icon: ‘warn’,

             duration: 1500

           })

           var filePath = res.tempFilePath

           wx.showToast({

             title: filePath,

             icon: ‘warn’,

             duration: 1500

           })

           wx.openDocument({

             filePath: filePath,

             success: function (res) {

               wx.showToast({

                 title: ‘1’,

                 icon: ‘warn’,

                 duration: 1500

               })

             },

             fail: function (err) {

               wx.showToast({

                 title: err,

                 icon: ‘warn’,

                 duration: 1500

               })

             }

           })

         },

          fail: function (err) {

           wx.showToast({

             title: err,

             icon: ‘warn’,

             duration: 1500

           })

         }

       })

4 回复

https的域名,

 有些下载了, openDocument 时就失败了, 错误信息是用户取消了。。。可是毛都操作。。

 没官方的人吗?

需要你设置下,下载的https域名。

回到顶部