Reading the Firebase documentation, once I have uploaded an image data to Firebase storage bucket (using putData()
), I can get a download URL by calling the downloadURL()
method from a StorageReference
instance.
And so I did :
uploadRef.downloadURL { (url, error) in
if error != nil {
print("failed to download url")
} else {
let stringURL = url!.absoluteString
downloadURLCompletion(stringURL)
}
}
stringURL
returns a public URL starting with https://firebasestorage.googleap...
But what I want to get and store in my Firebase database is the internal URI starting with gs://
Is there a way to request it from Firebase IOS SDK ? Firebase UI seems to provide it automaticaly, but I'm not using Firebase UI.
I know that I can generate this URI by using this template :
gs://<bucket_name>/<file_path_inside_bucket>
...but it assumes that I should hard-code the name of my bucket which doesn't make me happy...