AppAuth : issue when renewing authorization code : "attempting to load the view of a view controller while it is deallocating is not allowed"

I'm using AppAuth pod to handle user login with Azure in. I followed this sample : https://github.com/openid/AppAuth-iOS/tree/master/Examples it's fine until my authentication code expires. It works ok for the 1st connection and all the time while the authenticationCode is still valid.

Did anyone solved this issue ?
Code Block import UIKit
import AppAuth
import AuthenticationServices
var isLoginViewOn: Bool = false
var isConnectionBtnPressed: Bool = false
class ContainerController: UIViewController {
// MARKS : Properties
private var authState: OIDAuthState?
var token: String?
var menuController: MenuController!
var homeController: HomeController!
var panView: UIView!
var isExpanded = false
var isLoginOut: Bool = false
let loginView: UIImageView = {
let v = UIImageView()
v.image = UIImage(named: "")
v.contentMode = .scaleAspectFit
return v
}()
let connexionButton: UIButton = {
let b = UIButton(frame: CGRect(x: 100, y: 100, width: 100, height: 50))
return b
}()
let logoutBtn: UIButton = {
let b = UIButton(frame: CGRect(x: 100, y: 100, width: 100, height: 50))
b.setTitle("déconnexion", for: .normal)
return b
}()
override func viewDidLoad() {
super.viewDidLoad()
chekToken()
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
if isLoginViewOn == true {
if isConnectionBtnPressed == false {
self.connexionButton.sendActions(for: .touchUpInside)
isLoginViewOn = false
}
}
}
override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
view.layoutIfNeeded()
view.layoutSubviews()
}
/////////////////////////////////////////////////////////////////////////////
/// SET UP ////
/////////////////////////////////////////////////////////////////////////////
func setupLoginView() {
print("setup loginView")
isLoginViewOn = true
view.addSubview(loginView)
view.addSubview(connexionButton)
loginView.translatesAutoresizingMaskIntoConstraints = false
connexionButton.translatesAutoresizingMaskIntoConstraints = false
[
loginView.centerYAnchor.constraint(equalTo: view.centerYAnchor),
loginView.centerXAnchor.constraint(equalTo: view.centerXAnchor),
loginView.widthAnchor.constraint(equalToConstant: 250),
loginView.heightAnchor.constraint(equalToConstant: 128),
connexionButton.bottomAnchor.constraint(equalTo: loginView.topAnchor, constant: -50),
connexionButton.centerXAnchor.constraint(equalTo: view.centerXAnchor),
connexionButton.widthAnchor.constraint(equalToConstant: 200),
connexionButton.heightAnchor.constraint(equalToConstant: 50),
].forEach{$0.isActive = true }
connexionButton.addTarget(self, action: #selector(buttonAction(_:)), for: .touchUpInside)
if isConnectionBtnPressed == false {
self.connexionButton.sendActions(for: .touchUpInside)
}
}
func setupHomeController() {
homeController = HomeController()
homeController.delegate = self
addControllerAsChild(forController: homeController)
setupPanView(forController: homeController)
}
}

//////LOGIN////


```
And in AppDelegate I put this on the top :




and in the AppDelegate class :




I'm stuck with this for a while now and it's very annoying for my client, any suggestion is welcomed !
AppAuth : issue when renewing authorization code : "attempting to load the view of a view controller while it is deallocating is not allowed"
 
 
Q