【发布时间】:2015-07-30 18:45:34
【问题描述】:
我正在编写一个通用应用程序,我最初使用两个故事板文件编写它。我在 App Delegate didFinishLaunchingWithOptions 例程中有代码来决定要加载哪个故事板,然后它会消失。从那以后,我意识到这是一件愚蠢的事情,因为我有重复的代码,所以我删除了一个故事板,并使另一个故事板通用。我已经让 VC 指向正确的课程和所有内容。但是,我的应用程序现在拒绝启动。当我在 sim 中运行它时,它给了我错误
如果要使用主故事板文件,应用委托必须实现 window 属性。
.
这是我在 App Delegate 中的代码:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
var deviceIdiom = UIDevice.currentDevice().userInterfaceIdiom
if deviceIdiom == UIUserInterfaceIdiom.Phone {
strDevice = "iPhone"
} else if deviceIdiom == UIUserInterfaceIdiom.Pad {
strDevice = "iPad"
} else {
strDevice = "Unknown"
}
return true
}
我做错了什么?
(我已经看过但没有帮助的问题):
Unique Issue displaying first storyboard scene in Xcode
The app delegate must implement the window property if it wants to use a main storyboard file
Managing two storyboards in App Delegate
How to manually set which storyboard view to show in app delegate
Swift - Load storyboard programatically
【问题讨论】:
标签: ios swift appdelegate xcode-storyboard