Unbalanced calls to begin/end appearance transitions for...

There is a problem in my navigation controller after the google sign in here,
Code Block Swift
 UserDefaults.standard.set(downloadUrl, forKey: "profile_picture_url")
                          let vc = self?.storyboard?.instantiateViewController(identifier: "tabBarVC") as! TabBarViewController
                          vc.modalPresentationStyle = .fullScreen
                          self?.present(vc, animated: true)

Here is my code attached



Could you explain precisely what the problem is ?
Do you get an error message ? Where exactly ?
I get an error that says unbalanced calls to begin/end appearance transitions, when I am transitioning from the google sign in to the main view controller in this line of code,
Code Block Swift
 UserDefaults.standard.set(downloadUrl, forKey: "profile_picture_url")                          let vc = self?.storyboard?.instantiateViewController(identifier: "tabBarVC") as! TabBarViewController                          vc.modalPresentationStyle = .fullScreen                          self?.present(vc, animated: true)


In
Code Block
UserDefaults.standard.set(downloadUrl, forKey: "profile_picture_url")
let vc = self?.storyboard?.instantiateViewController(identifier: "tabBarVC") as! TabBarViewController vc.modalPresentationStyle = .fullScreen
self?.present(vc, animated: true)

Note: why optional chaining self? and not just self.
Did you try to present in the main thread ?

Code Block
let vc = self.storyboard?.instantiateViewController(identifier: "tabBarVC") as! TabBarViewController
vc.modalPresentationStyle = .fullScreen
DispatchQueue.main.async {
self.present(vc, animated: true)
}


No, its because I used weak self
And did you try the solution ?
Code Block
let vc = self?.storyboard?.instantiateViewController(identifier: "tabBarVC") as! TabBarViewController
vc.modalPresentationStyle = .fullScreen
DispatchQueue.main.async {
self?.present(vc, animated: true)
}


If that works, don't forget to close the thread. If not, please tell exactly what you get as error.
it doesn't work instead it says Unbalanced calls to begin/end appearance transitions for <(my project name).MainViewController: 0x7fc541815800>, (main view controller is my navigation controller)
Anyone have any solutions?
Don't animate present.
Replace
Code Block
self?.present(vc, animated: true)

with
Code Block
self?.present(vc, animated: false)

Also check you call super where needed, as you did in viewDidLoad.
Thanks, but this didn't help because I realized there is a problem with
my google sign in so it's not even reaching the line with this code...
Code Block Swift
self?.present(vc, animated: true)

So that means the problem is not in the code you posted in your first post ?

Code Block
UserDefaults.standard.set(downloadUrl, forKey: "profile_picture_url")
let vc = self?.storyboard?.instantiateViewController(identifier: "tabBarVC") as! TabBarViewController
vc.modalPresentationStyle = .fullScreen
self?.present(vc, animated: true)

If you click on the here is the code section of my question there is a google sign in function, and that's where the error is coming from.

what?
Unbalanced calls to begin/end appearance transitions for...
 
 
Q