在具有Xcode 11 GM种子2的iOS 13模拟器上,应用程序在Main.storyboard
的名称更改(Info.plist也更改)后崩溃。将选项设置Main Interface
为空会导致相同的问题。iOS 13系统始终尝试查找Main.storyboard
,并失败,并显示崩溃消息:
*** reason: 'Could not find a storyboard named 'Main' in bundle
在iOS 12和更早版本上,一切都很好。看起来像是iOS 13中的错误。
有人遇到同样的问题吗?还有什么解决方案?
搭载iOS 13的Swift 5
在Application Scene Manifest组下的info.plist文件中还需要进行另一项更改。
也可以在“ 应用程序场景清单”中更改名称。
附加:
如果要在iOS13上创建没有情节提要的根窗口,则需要从Info.plist中删除Main storyboard file base name
和Storyboard Name
项目,然后在以下位置以编程方式创建该窗口:SceneDelegate
class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. if #available(iOS 13.0, *) { //Do nothing here } else { window = UIWindow(frame: UIScreen.main.bounds) window?.makeKeyAndVisible() } return true } } class SceneDelegate: UIResponder, UIWindowSceneDelegate { var window: UIWindow? @available(iOS 13.0, *) func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). guard let windowScene = (scene as? UIWindowScene) else { return } window = UIWindow(windowScene: windowScene) // continue to create view controllers for window } //...... }