r***@163.com
r***@163.com
  • 发布:2025-01-16 09:43
  • 更新:2025-01-18 14:59
  • 阅读:27

uni.downloadFile微信小程序在ios真机上报错? 求解

分类:uni-app
uni.downloadFile({  
        url: "",  
        success: res => {  
          uni.openDocument({  
            filePath: res.tempFilePath,  
            showMenu: true,  
            success: () => {  
            },  
            fail: () => {  
              uni.showToast({title: "文件打开失败", icon: "none"});  
            },  
          });  
        },  
        fail: () => {  
          uni.showToast({title: "文件下载失败", icon: "none"});  
        },  
      });

直接报以下错误(下载地址有的,不便贴上来)

index.vue?2676:1 MiniProgramError
n.replace is not a function. (In 'n.replace(/\;([^\s\;]?(?=\=))/gi,",$1")', 'n.replace' is undefined)
TypeError: n.replace is not a function. (In 'n.replace(/\;([^\s\;]
?(?=\=))/gi,",$1")', 'n.replace' is undefined)
@https://usr//app-service.js:5632:10487
@https://lib/WAServiceMainContext.js:1:2656074
kn@https://lib/WASubContext.js:1:335639
Tnt@https://lib/WAServiceMainContext.js:1:2656060
@https://lib/WAServiceMainContext.js:1:1294171
at <api downloadFile success callback function>
Rc@https://lib/WAServiceMainContext.js:1:943425
@https://lib/WAServiceMainContext.js:1:1025749
at <NetworkDownload4success callback function>
$m@https://lib/WAServiceMainContext.js:1:996129
forEach@[native code]
emit@https://lib/WAServiceMainContext.js:1:996770
u@https://lib/WAServiceMainContext.js:1:1027383
eb@https://lib/WAServiceMainContext.js:1:1028738
@https://lib/WAServiceMainContext.js:1:1029362
@https://lib/WAServiceMainContext.js:1:917248
@https://lib/WAServiceMainContext.js:1:907153
emit@https://lib/WAServiceMainContext.js:1:377511
emit@[native code]
emit@https://lib/WAServiceMainContext.js:1:376883
subscribeHandler@https://lib/WAServiceMainContext.js:1:385313
@[native code]
global @ index.vue?2676:1

2025-01-16 09:43 负责人:无 分享
已邀请:
DCloud_UNI_OttoJi

DCloud_UNI_OttoJi - 日常回复 uni-app/x 问题,如果艾特我没看到,请主动私信

看报错是小程序内部报错。拆分一下问题,是 downloadFile 还是 openDocument 有问题?使用原生小程序测试一下,用 wx.downloadFile 测试,区分一下哪边的问题。

要回复问题请先登录注册