【文件操作】关于IOS 保存文件的问题?
发布于 4 年前 作者 bjiang 3915 次浏览 来自 问答

使用文件管理器

const fs = wx.getFileSystemManage();

fs.writeFile({

filePath: wx.env.USER_DATA_PATH+filename,

data: dataBuffer,

encoding: ‘base64’,

success(res) {

file.saveFile({

                tempFilePath: filePath,

                fail:(err)=>{

console.log(err)//IOS:saveFile:fail it is not a tempFilePath

console.log(err)//开发工具:saveFile:fail tempFilePath file not exist

                },

                success:(res)=>{

	}

)

},

})

这个 wx.env.USER_DATA_PATH 在安卓下可以成功保存

在IOS端 提示我 saveFile:fail it is not a tempFilePath

开发工具提示 saveFile:fail tempFilePath file not exist 这个说明上面的文件写入也没有成功 但是却在 writeFile.success里继续执行了file.saveFile

只有安卓可以 大家遇没遇到类似的问题呢

还有官方文档中wx.env.USER_DATA_PATH的出处在哪里呢

1 回复

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

回到顶部