首页 > 解决方案 > RNFS.exists 总是返回 false,即使图像存在于库中的反应本机

问题描述

我正在尝试在我的反应本机应用程序中检查我的移动存储中是否存在图像。但即使文件存在,它每次都会向我返回错误。我错过了什么吗?在此先感谢。

这是我的图像路径

file:///var/mobile/Containers/Data/Application/4B92ACDC-8DD1-4713-A841-CAFEBD180525/tmp/FB1923E6-A008-4B68-8B8D-6415F247EF59.jpg

代码

RNFS.exists(imagepath).then((val)=>{
                              if(val){
                                console.log("Exists");
                              }else{
                                console.log("Does not exits");
                              }
                              
                          }).catch((error)=>{
                            console.log(error);
                          })

标签: react-nativereact-native-fs

解决方案


推荐阅读