报错内容:openDocument:fail permission denied,下面两笔调用报一样的错。
pdfUrl 无论是远程还是本地,几百M还是几百K,都是一样的报错。
有个很奇怪的地方是,当我本次测试一个小 pdf 时,文件名叫 test.pdf,报错。文件名改成 test.png,居然打开成功了,并且给我生成了这么一个文件:test.png.pdf
这是什么 bug 么?
wx.getFileSystemManager().getFileInfo({
filePath: pdfUrl,
fileType: "pdf",
success: (res) => {
console.log('文件存在,大小:', res.size);
wx.openDocument({ filePath: filePath });
},
fail: (err) => {
console.error('文件不存在或路径错误:', err);
}
});
wx.openDocument({
url: pdfUrl,
filePath: pdfUrl,
fileType: "pdf",
success: (res) => {
console.log('PDF 打开成功');
},
fail: (err) => {
wx.showToast({
title: '打开 PDF 失败: ' + pdfUrl,
icon: 'none'
});
console.error('打开 PDF 失败:', err);
}
});
你好,麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)