Post

Replies

Boosts

Views

Activity

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. issue description - https://developer.apple.com/forums/content/attachment/9ebcf763-67fd-42e1-aa53-43c7874b2399 Did anyone solved this issue ? 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//// loginCode - https://developer.apple.com/forums/content/attachment/3871e591-b9f5-4edf-96b6-a24278a502a8 ``` And in AppDelegate I put this on the top : AppDelegate top - https://developer.apple.com/forums/content/attachment/accdf5ec-0666-428d-a4c5-e508d646f1fa and in the AppDelegate class : AppDelegateClass - https://developer.apple.com/forums/content/attachment/fabe83f9-31a9-426b-9db8-b34673eecafc deinit - https://developer.apple.com/forums/content/attachment/26b1b338-4e8c-4533-9466-4d1ed52b5d8e I'm stuck with this for a while now and it's very annoying for my client, any suggestion is welcomed !
0
0
1.1k
Sep ’20