iOS 18.1 Storyboard doesn't contain a view controller with identifier

Hi All

I faced up with strange issue in my app.

Everything works in iOS 18.0 and lower.

But after install iOS 18.1 same app from App Store crashes every time with error:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Storyboard (<UIStoryboard: 0x11f6287a0>) doesn't contain a view controller with identifier 'MKCPinEntryViewControllerIdentifier''

Interesting that this view controller exist in the Storyboard. First call in app:

dispatch_async(dispatch_get_main_queue(), ^{
        //No authentication, needs login view controller popped.
        UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
        PinEntryViewController *pinViewController = [storyboard instantiateViewControllerWithIdentifier:@"PinEntryViewControllerIdentifier"];
        pinViewController.delegate = self;
        pinViewController.entryType = PinEntryTypeEnter;
        [self.presentationContext presentViewController:pinViewController animated:YES completion:nil];
    });

works good.

But second call in other place after 5 seconds:

dispatch_async(dispatch_get_main_queue(), ^{
                UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
                PinEntryViewController *pinViewController = [storyboard instantiateViewControllerWithIdentifier:@"PinEntryViewControllerIdentifier"];
                pinViewController.delegate = self;
                
                [self.presentationContext presentViewController:pinViewController animated:YES completion:nil];
            });

crash the app with Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Storyboard (<UIStoryboard: 0x11f6287a0>) doesn't contain a view controller with identifier 'MKCPinEntryViewControllerIdentifier'' *** First throw call stack: (0x1841b47cc 0x1814872e4 0x186d9c140 0x1063d692c 0x10301ec08 0x104370a30 0x10437271c 0x104382de8 0x1043829a4 0x184188204 0x184185440 0x184184830 0x1d01641c4 0x186ceaeb0 0x186d995b4 0x10667fe3c 0x1a9b72ec8) libc++abi: terminating due to uncaught exception of type NSException

And issue not only with this view controller. issue with all in that storyboard. At start up instantiateViewControllerWithIdentifier works good with all view controllers identifiers. But on second call in other places in the app - all crash with same error

Reproduce in real device with iOS18.1 only. Simulators and devices with iOS 18.0 works well.

Could someone help me, what's wrong with the app?

I have the same problem

There seems to be an issue with the method:

[UIStoryboard storyboardWithName:@"Main" bundle:nil]

when I use:

self.storyboard

it can get the UIViewController with identifier.

We also ran into this issue with one our mature applications we have been maintaining for a long time this week with the release of 18.1

In this application there was a rather bloated main storyboard we were attempting to initialize most view controllers out of.

We solved our issue by abstracting out different scenes into smaller storyboards and initializing them individually.

In short, instead of initializing everything from 1 storyboard we now initialize scenes from 5 different storyboards.

I hope this helps.

iOS 18.1 Storyboard doesn't contain a view controller with identifier
 
 
Q