I have the following code:
let storageRef = FIRStorage().reference(forURL: "gs://slugbug-....appspot.com") // dots intentional
let imageRef = storageRef.child("testImage.jpg")
But the app crashes and I get the following message:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Provided bucket: slugbug-....appspot.com does not match the Storage bucket of the current instance: (null)'
Even if I use
let storageRef = FIRStorage().reference()
The bucket is nil.
Why?
You are missing .storage()
.
Check your line. It should be:
let storageRef = FIRStorage.storage().reference(forURL: "gs://slugbug-....appspot.com") // dots intentional
Hope it helps
I figured out the solution:
I changed the code from:
let storageRef = FIRStorage().reference(forURL: "gs://slugbug-....appspot.com")
to:
let storageRef = FIRStorage.storage().reference(forURL: "gs://slugbug-....appspot.com")
... a very subtle but annoying bug
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With