Expo文件系统Firebase存储can';t检索文件(403错误)

Expo文件系统Firebase存储can';t检索文件(403错误),firebase,react-native,expo,firebase-storage,Firebase,React Native,Expo,Firebase Storage,我正在尝试使用Expo文件系统从Firebase存储中检索一个文件,该文件的URL来自getDownloadURL。然而,我一直收到403的回复。我的规则是完全公开的,我甚至要求auth检查它是否修复了任何东西,但它没有。我已验证下载的URL是否有效(我已将其复制到浏览器中,并且可以正常工作) 代码 retrieveFileFromStorage = async (fileName, senderUid, downloadURL) => { let result = await F

我正在尝试使用Expo文件系统从Firebase存储中检索一个文件,该文件的URL来自getDownloadURL。然而,我一直收到403的回复。我的规则是完全公开的,我甚至要求auth检查它是否修复了任何东西,但它没有。我已验证下载的URL是否有效(我已将其复制到浏览器中,并且可以正常工作)

代码

retrieveFileFromStorage = async (fileName, senderUid, downloadURL) => {
    let result = await FileSystem.downloadAsync(
        downloadURL,
        FileSystem.documentDirectory + fileName,
        { headers: { 'Content-Type': 'image/png' } }
    )

    console.log(result);
    return result.uri;
}
Object {
  "headers": Object {
    "Cache-Control": "private, max-age=0",
    "Content-Length": "378",
    "Content-Type": "application/xml; charset=UTF-8",
    "Date": "Tue, 31 Mar 2020 02:12:00 GMT",
    "Expires": "Tue, 31 Mar 2020 02:12:00 GMT",
    "Server": "UploadServer",
    "alt-svc": "quic=\":443\"; ma=2592000; v=\"46,43\",h3-Q050=\":443\"; ma=2592000,h3-Q049=\":443\"; ma=2592000,h3-Q048=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,h3-T050=\":443\"; ma=2592000",
    "x-guploader-uploadid": "<removed>",
  },
  "status": 403,
  "uri": "file:///var/mobile/Containers/Data/Application/<...>/image.png",
}
响应

retrieveFileFromStorage = async (fileName, senderUid, downloadURL) => {
    let result = await FileSystem.downloadAsync(
        downloadURL,
        FileSystem.documentDirectory + fileName,
        { headers: { 'Content-Type': 'image/png' } }
    )

    console.log(result);
    return result.uri;
}
Object {
  "headers": Object {
    "Cache-Control": "private, max-age=0",
    "Content-Length": "378",
    "Content-Type": "application/xml; charset=UTF-8",
    "Date": "Tue, 31 Mar 2020 02:12:00 GMT",
    "Expires": "Tue, 31 Mar 2020 02:12:00 GMT",
    "Server": "UploadServer",
    "alt-svc": "quic=\":443\"; ma=2592000; v=\"46,43\",h3-Q050=\":443\"; ma=2592000,h3-Q049=\":443\"; ma=2592000,h3-Q048=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,h3-T050=\":443\"; ma=2592000",
    "x-guploader-uploadid": "<removed>",
  },
  "status": 403,
  "uri": "file:///var/mobile/Containers/Data/Application/<...>/image.png",
}
对象{
“标题”:对象{
“缓存控制”:“专用,最大年龄=0”,
“内容长度”:“378”,
“内容类型”:“应用程序/xml;字符集=UTF-8”,
“日期”:“2020年3月31日星期二02:12:00 GMT”,
“到期”:“2020年3月31日星期二02:12:00 GMT”,
“服务器”:“上传服务器”,
“alt svc”:“quic=\”:443\“ma=2592000;v=\“46,43\”,h3-Q050=\”:443\“ma=2592000,h3-Q049=\”:443\“ma=2592000,h3-Q048=\”:443\“ma=2592000,h3-Q046=\”:443\“ma=2592000,h3-Q043=\”:443\“ma=2592000,h3-T050=”2592000“,
“x-guploader-uploadid”:“”,
},
“状态”:403,
“uri”:file:///var/mobile/Containers/Data/Application//image.png",
}
注意:由于我可以将函数中的
downloadURL
复制到浏览器中,并且图像显示得很好,这是否意味着错误在使用文件系统检索文件时发生

另一个注意事项:同时删除
内容类型
会导致
[未处理的承诺拒绝:错误:无法从下载]
错误。但是URL是有效的,为什么不能从URL下载呢

这发生在iOS 13上,包括设备和模拟器