I am making an app that stores photos for the user and I am trying to get some values from the Firebase database using .observeSingleEvent(). I used the same block of code earlier and successfully but now I am getting the error, "URL scheme must be one of gs://, http://, or https://". Here is my code:
let databaseRef = Database.database().reference()
let coverPhotosRef = databaseRef.child("images_" + (Auth.auth().currentUser?.uid)! + "_links/CoverPhotos")
print("Reference: " + String(describing: coverPhotosRef))
//error occurs here when code calls observeSingleEvent
coverPhotosRef.observeSingleEvent(of: .value, with: { (snapshot) in
for rest in snapshot.children.allObjects as! [DataSnapshot] {
//do stuff
}
})
I can't figure out why it doesn't work. I printed coverPhotosRef and I get the correct URL in https:// format which leads to my database. I haven't gotten this error before even though I used the same exact code elsewhere. Any help is appreciated. Thanks.