7

I wish I had never updated my pod, the entire project was full of errors, one specific error is in the photo below, I can't fix it and I was ready to submit my app to the App Store now it seems like its all ruined. On top of this, it made me erase a bunch of optionals.

error message

 func uploadData(user: User) {
    let changeRequest = user.createProfileChangeRequest()
    changeRequest.displayName = self.nameUser.text!
    changeRequest.commitChanges(completion: nil)

    let imageRef = self.userStorage.child("\(user.uid).jpg")

    let data = UIImageJPEGRepresentation(self.imageView.image!, 0.5)

    let uploadTask = imageRef.put(data!, metadata: nil, completion: { (metadata, err) in
        if err != nil {
            print(err!.localizedDescription)
        }

        imageRef.downloadURL(completion: { (url, er) in
            if er != nil {
                print(er!.localizedDescription)
            }


            if let url = url {



                let userInfo: [String : Any] =  ["age" : self.ageUser.text!,
                                                 "location" : self.location.text!,
                                                 "name" : self.nameUser.text!,
                                                 "image" : url.absoluteString,
                                                 "bio" : self.bioViewTwo.text!,
                                                 "contact" : self.contactUser.text!
                ]

                self.ref.child("SJ").child(user.uid).setValue(userInfo)

            }

        })

    })

    uploadTask.resume()
}
Paulo Mattos
  • 18,845
  • 10
  • 77
  • 85
user8000557
  • 137
  • 8

1 Answers1

10

Looks like you just upgraded to Firebase version 4 ;) This new version contains many breaking changes (and some good stuff too!) for Swift based projects.

You should follow their migration guide to fix your issues. For instance, the error you highlighted, on the StorageReference class, can easily be fixed by renaming the offending put method to putData, and so on.

By the way, no naming changes have been made to the Objective-C SDK.

Paulo Mattos
  • 18,845
  • 10
  • 77
  • 85
  • Thank you, I guess I was panicking for nothing, may I ask what exactly these "good stuff" are that you speak of? – user8000557 May 21 '17 at 04:05
  • Please see [this list](https://firebase.google.com/support/release-notes/ios#4.0.0) for a quick summary of the major changes. There also many nice videos on their YouTube channel as well. – Paulo Mattos May 21 '17 at 04:12