instantiateInitialViewController crash on TestFlight

When we run app from xcode version "11.2.1" to a device, it works properly, but when we submit it to the App Store and try to test it crashes on iOS 13.* "UIStoryboard(name: "Main", bundle: Bundle.main).instantiateInitialViewController()".

It looks like that from xcode it runs differently compared to on store. Please say how to solve this problem?

Replies

What do you get in crashlog ?


Did you try just passing nil as bundle :


let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let myVC: MyVC = mainStoryboard.instantiateViewController(withIdentifier: "MyVC") as! MyVC

Having same issue. App store rejected twice. I cannot reproduce the issue at my iPhone iOS 13.3. Did you able to fix this?


- (UIViewController *)getViewControllerFromStoryBoardsWithID:(NSString *)viewControllerStoryboardID{

UIStoryboard *sb =[self getStoryboardContainingViewControllerWithID:viewControllerStoryboardID];

if (sb){

return [sb instantiateViewControllerWithIdentifier:viewControllerStoryboardID];

} else {

return nil;

}

}


Crashlogs says it's crashing at " return [sb instantiateViewControllerWithIdentifier:viewControllerStoryboardID]"

Got some more detailed crashlogs when downloaded from Testflight. App was having UISearchdisplaycontroller in the storyboard. It's no longer supported from iOS 13. So the app was crashing.


https://stackoverflow.com/questions/57819165/installed-app-from-testflight-crashes-due-to-alleged-uisearchdisplaycontroller

Hi,


I am not using UISearchdisplaycontroller, It has just UITableView nothing else but it is crashing in Testflight build, no idea why. Can anyone help?