Add*_* F. 3 xcode storyboard ios swift xcode11
This question has been asked before, but my issue is specifically with Xcode 11 and UISceneConfiguration. Before Xcode 11, when you deleted a storyboard (Main.storyboard) from your target, then added a new one (AnotherStoryboard.storyboard), you would have to update Targets > General > Deployment Info > Main Interface to use your newly added storyboard. In Xcode 11, this is not sufficient and the app will throw an exception
*** Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: 'Could not find a storyboard named 'Main' in bundle NSBundle
Run Code Online (Sandbox Code Playgroud)
The problem I found was that in Info.plist, there is now a new key titled UIApplicationSceneManifest that has a nested UISceneStoryboardFile in it that is being updated when you change the Main Interface within the target. However, there is still a UIMainStoryboardFile key at the top level of Info.plist that is holding the title of the old "Main" storyboard. Long story short, if you delete UIMainStoryboardFile, the app will run fine.
My question: Is this a bug in Xcode 11 or is there something else I'm missing that would prevent this? I didn't really find anything useful while I was trying to debug it and ended up figuring it out on my own.
在你的info.plist Main文件中设置Scene Configuration,所以它总是找到那个文件并抛出异常。您可以以ViewController编程方式设置默认值。在您的info.plist设置Scene Configuration中Default configuration选择无进入Targets> General> Deployment Info> Main Interface。
你sceneWillConnectTo就像
window = UIWindow(frame: UIScreen.main.bounds)
window!.windowScene = windowScene
window!.rootViewController = //your homeVC
window!.makeKeyAndVisible()
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4768 次 |
| 最近记录: |