0
func uploadGoogleProfileImage(_ image:UIImage, completion: @escaping ((_ url:URL?)->())) {
    guard let uid = Auth.auth().currentUser?.uid else { return }
    let storageRef = Storage.storage().reference().child("userGoogleImage/\(uid)")

    guard let imageData = UIImage.jpegData(compressionQuality: 0.75) else { return }

    let metaData = StorageMetadata()
    metaData.contentType = "image/jpg"

    storageRef.putData(imageData, metadata: metaData) { metaData, error in
        if error == nil, metaData != nil {

            storageRef.downloadURL{ url, error in
                completion(url)
            }
        } else {
            // failed
            completion(nil)
        }
    }
}

The error displays on the line where UIImage.jpegData is being used. Not sure why I'm receiving this error?

rmaddy
  • 314,917
  • 42
  • 532
  • 579

1 Answers1

0

jpegData has been changed to be an instance method rather than a class method. So changing

guard let imageData = UIImage.jpegData(compressionQuality: 0.75) else { return }

to

guard let data = image.jpegData(compressionQuality: 0.75) else { return }

will do the trick.