“ StorageMetadata”类型的值?没有成员“ downloadURL”

时间:2019-01-13 18:49:47

标签: swift firebase firebase-storage

我想将PhotoURL与Firebase一起存储,但是出现错误,提示Value of type 'StorageMetadata?' has no member 'downloadURL'

        view.endEditing(true)
        ProgressHUD.show("Waiting...", interaction: false)
        if let profileImg = self.selectedImage, let imageData = profileImg.jpegData(compressionQuality: 0.1)  {
            let photoIdString = NSUUID().uuidString
            print(photoIdString)
            let storageRef = Storage.storage().reference(forURL: Config.STORAGE_ROOF_REF).child("posts").child(photoIdString)
            storageRef.putData(imageData, metadata: nil, completion: { (metadata, error) in
                if error != nil {
                    ProgressHUD.showError(error!.localizedDescription)
                    return
                }
                let photoUrl = metadata.downloadURL()?.absoluteString //Error is here 
                self.sendDataToDatabase(photoUrl: photoUrl!)
            })
        } else {
            ProgressHUD.showError("Profile Image can't be empty")
        }
    }

let photoUrl = metaData.downloadURL()?.absoulteString,我收到一个Xcode错误,提示Value of type 'StorageMetadata?' has no member 'downloadURL'

0 个答案:

没有答案