收藏
回答

FileSystemManager.saveFile在ios报错?

使用FileSystemManager的writeFile后调用saveFile接口后在ios上报错,提示saveFile fail it is not a tempFilePath,在安卓上是没有问题的

基础调试库版本:2.24.1

代码:

const fileName = `${formatDate(new Date(),'yyyymmdd')}.xlsx`

const path = `${wx.env.USER_DATA_PATH}/${fileName}`

console.log('path',path)

fs.writeFile({

filePath: path,

data: res,

success(res) {

console.log('writeFile success',res)

fs.saveFile({

tempFilePath: path,

filePath: path,

success(res) {

console.log('saveFile success',res,path)

_this.tui.toast("保存成功")

setTimeout(() => {

uni.navigateTo({

url: `./preview?path=${path}&fileName=${fileName}`

})

},1000)


},

fail(res) {

console.log('fail',res)

}

});

},

fail(err) {

console.log('writeFile fail',err)

}

})

ios上报错截图:

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

4 个回答

登录 后发表内容