Upload custom metadata using Firebase Storage

I have an application where I want to save a signature with a photo, but in my case I use FIRStorage to store photos. Everything works there, but I want to keep the signature in the photo metadata. Don't ask why, it just makes sense for my project.

let meta = FIRStorageMetadata.init(dictionary: ["customMetadata" :
["caption" : self.textField.text!]])
                let imageRef = storageRef.child(iid)
            imageRef.put(uploadData, metadata: meta, completion: {     (metadata, error) in
                    if error != nil {
                        //failure
                        print(error)
                        return
                    } else {

                    //success
                    print(metadata)

                }
            })

As you can see, I even set up the metadata constant exactly as Firebase says in its documentation. When I pass meta into metadata in .put, why doesn't it use my own metadata? Thanks for helping the guys

+4
source share
1 answer

! . :

var meta = FIRStorageMetadata()
meta.customMetadata = ["caption" : self.textField.text!]

.put

+4

Source: https://habr.com/ru/post/1653234/


All Articles