Unity 2017.3.1p3 copies my storyboard to the Xcode project, but there doesn’t seem to be a way to include images in an xcassets folder. When I manually add the xcassets in Xcode, the launch screen storyboard appears correctly, but Unity crashes on startup:
Uncaught exception: NSInvalidArgumentException: Storyboard (<UIStoryboard: 0x1664c580>) doesn’t contain a view controller with identifier ‘unitySplashStoryboard’
I’ve been digging into this some more by looking at the Unity source code in XCode. What it looks like to me is that in the SplashScreen.mm code, ShowSplashScreen() wants a UIViewController with ID ‘unitySplashStoryboard’ so I added that to my storyboard. That fixes the first crash above, but then it crashes in ShowSplashScreen() a few lines later when it calls [_controller create: window] because UIViewController doesn’t contain the ‘create’ selector. It clearly is looking for _controller to be a SplashScreenController instance, but it isn’t possible to assign custom classes (like SplashScreenController) to LaunchScreen storyboards, so I don’t get how this code is supposed to work?
Out of curiosity, if you make your storyboard controller have a custom class of SplashScreenController with storyboard ID unitySplashStoryboard does it work as expected? I’ve attached a screen shot for reference.
There were supposed to be some docs for this but they must have fallen through the cracks. I’ll see what I can do about that.
I’m not sure what your point is. If you try to compile with that storyboard using a custom class as a launch screen storyboard, you’ll get an error. My experience is that launch storyboards only work with core classes, like UIViewController. It will not work with a derived custom class.
Thanks @Masterfalcon - while that fixes the crash, I don’t think that’s the expected solution because then there’s a black screen after this and before the Unity Splash screen. I noticed there is code elsewhere in the Unity IOS startup code (I don’t recall where at the moment) - where it tries to display the storyboard. This is a good thing as I think it’s trying to avoid having a black screen by displaying the Launch Storyboard again. However, I believe this code to display the Launch Storyboard again is broken. The fix above avoids this code, but that is not ideal.
Also there’s no way to have xcasset images with your Storyboard. Unity needs to find and copy those associated assets to the IOS (XCode) project folder and add it to the XCode solution/project file.
Sorry, in that method ShowSplashScreen, it creates the view controller from the storyboard to avoid that black screen. Elsewhere above in the SplashScreen class, it checks if the storyboard is being used and it doesn’t show the Launch Images or “nib” file alternative. If you remove that code as you suggest in ShowSplashScreen, then you get black after the Storyboard launch screen, which looks bad.
I’m facing the same problem. Changing ShowSplashScreen as Masterfalcon mentioned above works (application is booting again) but it does not look good because it is immediate fading to black.