我正在使用expo,并且一直在尝试使用expo-image-picker将相机或图库中的本地图像上传到Firebase。到目前为止,这是我的代码:
const uploadImage = async (uri, imageName) => {
const response = await fetch(uri);
const blob = await response.blob();
var ref = firebase
.storage()
.ref()
.child("images/" + imageName);
console.log(ref);
return ref.put(blob); };
uploadImage(uri, "Test_image");
我不断收到此错误消息:
Possible Unhandled Promise Rejection (id: 0):
FirebaseStorageError {
"code_": "storage/unauthorized",
"message_": "Firebase Storage: User does not have permission to access 'images/Test_image'.",
"name_": "FirebaseError",
"serverResponse_": "{
\"error\": {
\"code\": 403,
\"message\": \"Permission denied. Could not perform this operation\"
}
}",
}