简体   繁体   English

iOS7和iOS8之间的Root View Controller差异

[英]Root View Controller discrepancy between iOS7 and iOS8

My app is crashing on iOS7 since for some reason the rootViewController is a UINavigationController instead of a UISplitViewController . 我的应用程序是在iOS7崩溃,因为出于某种原因, rootViewControllerUINavigationController ,而不是一个UISplitViewController So the app crashes on the first line which is let splitViewController = self.window!.rootViewController as UISplitViewController in AppDelegate . 因此,应用程序在第一行崩溃, let splitViewController = self.window!.rootViewController as UISplitViewController AppDelegate let splitViewController = self.window!.rootViewController as UISplitViewController Is there like a fix or workaround for this? 是否有解决方法或解决方法? It works fine on iOS8 在iOS8上运作良好

Okay so the issue is UISplitViewController is only used for iPads, not iPhones. 好的,问题是UISplitViewController仅用于iPad,而不是iPhone。 So make sure your target under your project is set to iPads only if you need to have a UISplitViewController. 因此,只有在需要具有UISplitViewController的情况下,才能确保将项目下的目标设置为iPad。 If you want to support both devices I would recommend checking to see which device idiom your app is currently running on launch and alternate between two storyboards (If you do that make sure your target is for Universal devices instead of just iPad). 如果您想同时支持这两种设备,我建议您检查一下您的应用当前在启动时正在运行的设备惯用语,并在两个情节提要之间切换(如果这样做,请确保您的目标是通用设备而不是iPad)。 <--- This covers iOS 7 support, and the reason for the app not crashing on iOS 8 is because the UISplitViewController is now allowed on all iOS devices when it was not allowed on iPhones in iOS 7. <---这涵盖了对iOS 7的支持,并且该应用程序无法在iOS 8上崩溃的原因是,现在,当iOS 7中的iPhone上不允许使用UISplitViewController时,可以在所有iOS设备上使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM