I am trying to delete content within a folder in firebase storage:
I attempt to do so with the following function:
let storageRef = Storage.storage().reference().child((Auth.auth().currentUser?.uid)!).child("post:\(selectedPost.media[0].postID!)/")
// let postRef = storageRef.child("image.png")
// Delete the file
storageRef.delete { error in
if error != nil {
// Uh-oh, an error occurred!
print("FAIL DELETING POST FROM STORAGE")
} else {
// File deleted successfully
print("SUCCESS DELETING STORAGE REF TO POST!")
}
}
The problem is that it does not do that. It prints that it has failed:
Optional(Error Domain=FIRStorageErrorDomain Code=-13010 "Object LWzvQXAoX3Ov9DW9LopWFFjJBJY2/post:579755726 does not exist." UserInfo={object=LWzvQXAoX3Ov9DW9LopWFFjJBJY2/post:579755726, ResponseBody={
"error": {
"code": 404,
"message": "Not Found. Could not delete object",
"status": "DELETE_OBJECT"
}
}
When checking in the storage I can clearly see that that folder does exist.
What is wrong?