Firebase commitChangesWithCompletion on ProfileChangeRequest Not Firing

I take the exact code from the Firebase directory, put it inside the method and execute the completion handler (or function). Does anyone know why?

let user = FIRAuth.auth()?.currentUser
if let user = user {
    let changeRequest = user.profileChangeRequest()

    changeRequest.displayName = "Jane Q. User"
    changeRequest.photoURL =
    NSURL(string: "https://example.com/jane-q-user/profile.jpg")
      changeRequest.commitChangesWithCompletion { error in
    if let error = error {
      // An error happened.
    } else {
      // Profile updated.
    }
  }
}
+4
source share
2 answers

Perhaps this did not work because you tried to print the username or display it before the completion of the completion block. You can send to the main thread inside the completion block to cancel when necessary. That's what happened to me, so I just think.

+1
source

You might want to give more context. When do you call this function? What function does this code block located in?

. , , , .

, Documentation , . Firebase Documentation , , , .

+1

All Articles