Search code examples
iosswiftxcodeswift3testflight

Storyboard doesn't contain a view controller with identifier only on TestFlight


I use XLPagerTabStrip library for iOS app. I override function from this library for create controllers:

override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {

    var controllers:[UIViewController] = []

    let storyboard = UIStoryboard(name: "MediaStoryboard", bundle: nil)
    let controller = storyboard.instantiateViewController(withIdentifier: "VideosListController") as! VideosListController
    controllers.append(controller)

    let controllerNews = storyboard.instantiateViewController(withIdentifier: "NewsListController") as! NewsListController
    controllers.append(controllerNews)

    return controllers
}

My MediaStoryboard.storyboard (NewsController): Link to image

When I run it through Xcode it all work great. But when I upload it to iTunes Connect and run it through TestFlight I get this error in the logs:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Storyboard (<UIStoryboard: 0x1c447f4c0>) doesn't contain a view controller with identifier 'NewsListController'' 
*** First throw call stack:
(0x181b82d8c 0x180d3c5ec 0x18c0d1ea8 0x1004da07c 0x101561dfc 
0x1015626fc 0x101562a48 0x101552064 0x101553238 0x1004d9b40 0x1004d9e6c 
0x18b75eee0 0x18b75eacc 0x18ba9c3b4 0x18b80bac8 0x18b80b720 0x18b7ff424 
0x18b757770 0x185cf925c 0x185cfd3ec 0x185c69aa0 0x185c915d0 0x18bb3054c 
0x18c10d4c0 0x18c106258 0x181b2b404 0x181b2ac2c 0x181b2879c 0x181a48da8 
0x183a2b020 0x18ba2978c 0x10044ce64 0x1814d9fc0)

Why, ty?


Solution

  • You've probably already found an answer by now and I suspect there are multiple ways to get there. But for other readers who've come here to solve this frustrating issue, this is what worked for me:

    1. Open your storyboard and click the offending scene. If you check the Identity inspector, you may see something like this: module-not-entered-correctly

    2. Click inside the field Module and explicitly select the module, even though it already seems to be correctly selected. It will now look like this: module-entered-explicitly

    3. Clean, build and run.