问题描述
我正在尝试在我的存储设备上注册我的照片。所以基本上,我的用户需要在他的手机上(使用 imagepicker)捕捉他的照片,然后我想在我的 Firestore 存储上注册这张照片,然后在我的用户模型上注册这张照片。
然后当我点击图片时她无法被阅读
我的代码也启用了拒绝:错误:[storage/file-not-found] 指定的本地文件在设备上不存在。 NativeFirebaseError: [storage/file-not-found] 指定的本地文件在设备上不存在。
这很奇怪,因为该路径已在我的存储中注册。
也是我的功能:
<Icon
name="camera-retro"
size={30}
color="#5DC1D3"
onPress={async () =>
launchImageLibrary(
{
mediaType: "photo",includeBase64: false,maxHeight: 200,maxWidth: 200,},async (response) => {
let image = response.path;
let reference = storage().ref("PicturesUsers/" + image);
console.log(reference);
const pathToFile =
`${utils.FilePath.PICTURES_DIRECTORY}/` + response.path;
await reference.putFile(pathToFile);
console.log(pathToFile);
},async (response) => {
firestore()
.collection("Users")
.doc(await AsyncStorage.getItem("userID"))
.update({
Picture: response,})
.then(async () => {
setResponse(response);
console.log(pathToFile);
firestore()
.collection("Users")
.doc(await AsyncStorage.getItem("userID"))
.get()
.then((documentSnapshot) => {
console.log("User exists: ",documentSnapshot.exists);
if (documentSnapshot.exists) {
console.log(
"User data: ",documentSnapshot.data().Picture.uri
);
}
});
});
}
)
}
/>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)