【问题标题】:My empty swift app crashes on xcode6-beta with deployment target 7.1我的空 swift 应用程序在部署目标 7.1 的 xcode6-beta 上崩溃
【发布时间】:2014-06-18 16:48:18
【问题描述】:

我的目标是验证 swift 应用程序/代码是否可以在 iOS 7 模拟器上运行 我正在关注这个问题Do Swift-based applications work on OS X 10.9/iOS 7 and lower? 特别是这个答案-@Anil https://stackoverflow.com/a/24038997

以下是我遵循的步骤

  1. 已安装 xcode6 测试版
  2. 从 Xcode6->Preferences->Downloads 安装 iOS 7.1 模拟器
  3. 现在,我创建了一个新的 iOS Application Master Detail 项目并选择了 swift 作为语言
  4. 使用默认设置我能够运行应用程序
  5. 现在我按照这个 -https://stackoverflow.com/a/24038727 并将部署目标更改为 7.1,将模拟器更改为 iPhone 5-7.1。
  6. 现在我可以看到我的 iOS 7.1 模拟器了 当我尝试运行它时,我构建成功,但应用程序因 swift dynamic cast excption 而崩溃

libswift_stdlib_core.dylib`swift_dynamicCast:

【问题讨论】:

  • 在 iPad 上试用。您的问题可能是由新的 UISplitViewController 内容引起的。该类的文档说:in previous versions of iOS, the class is available only on iPad.
  • @SantaClaus 成功了!嗯,你为什么不把它作为答案,我会接受的。

标签: ios swift xcode6


【解决方案1】:

Master-Detail Xcode 项目模板创建一个带有 UISplitViewController 作为根视图控制器的故事板。

在 iOS 8 之前,UISplitViewController 仅适用于 iPad。文档指出:

在 iOS 8 及更高版本中,您可以在所有设备上使用 UISplitViewController 类 iOS 设备;在以前的 iOS 版本中,该类仅可用 在 iPad 上。

可能想要load a different storyboard 获取运行旧版 iOS 的设备。我一直想知道苹果希望我们如何使用 iOS 8 来解决这个问题。阅读 Apple 所说的 Adaptive View Controllers 或观看 a WWDC video 可能是个好主意。我相信“使用 UIKit 构建自适应应用程序”涵盖了 UISplitViewController 的新功能

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多