krishna solanki
krishna solanki

Reputation: 53

Getting crash in xcode 11.3 viewcontroller getting nill

Getting error :: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: ' returned nil from -traitCollection, which is not allowed.

It is crashing in this method func carbonTabSwipeNavigation(_ carbonTabSwipeNavigation: CarbonTabSwipeNavigation, viewControllerAt index: UInt) -> UIViewController { let sb = UIStoryboard.init(name: storybordname, bundle: nil) var viewcontroller:UIViewController! viewcontroller = sb.instantiateViewController(withIdentifier: controllername) return viewcontroller } When i Checked after putting breakpoint its crashing on the first line super.viewDidLoad()

Upvotes: 0

Views: 136

Answers (1)

Lokesh gupta
Lokesh gupta

Reputation: 94

Put your viewdidload code in disptachQueue

DispatchQueue.main.asyncAfter(deadline: .now() + 0.3, execute: {
               // Your Code
  })

Like this...

Upvotes: 2

Related Questions