Переход из VC в VC


#1

Есть программный переход с условием
вот
URLSession.shared.dataTask(with: request) { data, _, error in

        if  let dict = (try? JSONSerialization.jsonObject(with: data!)) as? [[String: Any]] {
            
            if let drt = dict[0]["error"] as Any? {
            // (dict[0]["idAcc"] as Any?) != nil
              print("Ошибка")
           return
            }
                     }
        
        let mcon: ViewControllerM = self.storyboard?.instantiateViewController(withIdentifier: "mcon") as!
        ViewControllerM
        self.navigationController?.pushViewController(mcon, animated: true)
        
        }.resume()
   
   
}

}
при выполнении появляется много всего, и долго обрабатывается, это переход между 1 и 2 ым vc , а переход между 3 и 4 далее не осуществляется вот их код

   let uname: unameViewController = self.storyboard?.instantiateViewController(withIdentifier: "uname") as!
        unameViewController
        self.navigationController?.pushViewController(uname, animated: true)
    }
}
как исправить?

#2

Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘-[UIKeyboardTaskQueue waitUntilAllTasksAreFinished] may only be called from the main thread.’
*** First throw call stack:
(
0 CoreFoundation 0x000000011098b1e6 __exceptionPreprocess + 294
1 libobjc.A.dylib 0x0000000110020031 objc_exception_throw + 48
2 CoreFoundation 0x0000000110990472 +[NSException raise:format:arguments:] + 98
3 Foundation 0x000000010fac3652 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193
4 UIKit 0x0000000111b84cbf -[UIKeyboardTaskQueue waitUntilAllTasksAreFinished] + 380
5 UIKit 0x0000000111103690 -[UIKeyboardImpl setDelegate:force:] + 1585
6 UIKit 0x00000001115edb65 -[UIPeripheralHost(UIKitInternal) _reloadInputViewsForResponder:] + 1250
7 UIKit 0x00000001110360b5 -[UIResponder _finishResignFirstResponder] + 267
8 UIKit 0x0000000111b1cebf -[UITextField _finishResignFirstResponder] + 48
9 UIKit 0x00000001110361fe -[UIResponder resignFirstResponder] + 275
10 UIKit 0x0000000111b1cd8f -[UITextField resignFirstResponder] + 135
11 UIKit 0x0000000111037a62 -[UIResponder _resignIfContainsFirstResponder] + 267
12 UIKit 0x0000000110ebf0ee -[UIView(Hierarchy) _willMoveToWindow:] + 553
13 UIKit 0x0000000110ed03fc -[UIView(Internal) _addSubview:positioned:relativeTo:] + 453
14 UIKit 0x0000000110deff6f __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke_2 + 2201
15 UIKit 0x0000000110ec8b6a +[UIView(Animation) performWithoutAnimation:] + 90
16 UIKit 0x0000000110def687 __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke + 250
17 UIKit 0x0000000110ecefce +[UIView(Internal) _performBlockDelayingTriggeringResponderEvents:] + 187
18 UIKit 0x0000000110deeff5 -[_UINavigationParallaxTransition animateTransition:] + 1224
19 UIKit 0x0000000110fde688 -[UINavigationController _startCustomTransition:] + 3627
20 UIKit 0x0000000110ff4582 -[UINavigationController _startDeferredTransitionIfNeeded:] + 714
21 UIKit 0x0000000110ff586c -[UINavigationController __viewWillLayoutSubviews] + 150
22 UIKit 0x000000011124dd0b -[UILayoutContainerView layoutSubviews] + 231
23 UIKit 0x0000000110ed77a8 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1515
24 QuartzCore 0x000000011739c456 -[CALayer layoutSublayers] + 177
25 QuartzCore 0x00000001173a0667 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 395
26 QuartzCore 0x00000001173270fb _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 343
27 QuartzCore 0x000000011735479c _ZN2CA11Transaction6commitEv + 568
28 QuartzCore 0x0000000117354e61 _ZN2CA11Transaction14release_threadEPv + 213
29 libsystem_pthread.dylib 0x00000001152be1aa _pthread_tsd_cleanup + 534
30 libsystem_pthread.dylib 0x00000001152bdee9 _pthread_exit + 79
31 libsystem_pthread.dylib 0x00000001152bc24b _pthread_wqthread + 1613
32 libsystem_pthread.dylib 0x00000001152bbbe9 start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) вот такая ошибка появляется