Значение типа 'EditProfileVc' не имеет члена 'storageRef' в swift 4 - PullRequest
0 голосов
/ 29 мая 2018

Click here for image

func imagePickerController(picker: UIImagePickerController, didFinishPickingImage image: UIImage, editingInfo: [String : AnyObject]?) {
            profileImage.image = image
            dismiss(animated: true, completion: nil)
            var data = NSData()
            data = UIImageJPEGRepresentation(profileImage.image!, 0.8)! as NSData
            // set upload path
            let filePath = "\(Auth.auth().currentUser!.uid)/\("userPhoto")"
            let metaData = StorageMetadata()
            metaData.contentType = "image/jpg"
            self.storageRef.child(filePath).putData(data, metadata: metaData){(metaData,error) in
                if let error = error {
                    print(error.localizedDescription)
                    return
                }else{
                    //store downloadURL
                    let downloadURL = metaData!.downloadURL()!.absoluteString
                    //store downloadURL at database
                    self.databaseRef.child("users").child(FIRAuth.auth()!.currentUser!.uid).updateChildValues(["userPhoto": downloadURL])
                }

            }
        }

1 Ответ

0 голосов
/ 29 мая 2018

Попробуйте использовать

Storage.storage().reference()

Вместо

self.storageRef
...