Swift应用程序在ios 8.x上呈现黑屏

时间:2015-10-23 15:09:40

标签: ios swift

我有一个非常基本的应用程序:

  • 一个视图控制器
  • 图像背景w / 3标签
  • 一键

当我在iOS 9上运行我的应用程序没问题。在iOS 8.x:黑屏。

这是我的AppDelegate

;; For HI, SI and DI modes, or $-1,reg is smaller than mov $-1,reg.
(define_peephole2
  [(set (match_operand:SWI248 0 "register_operand")
    (const_int -1))]
  "(optimize_insn_for_size_p () || TARGET_MOVE_M1_VIA_OR)
   && GENERAL_REGNO_P (REGNO (operands[0]))
   && peep2_regno_dead_p (0, FLAGS_REG)"
  [(parallel [(set (match_dup 0) (const_int -1))
          (clobber (reg:CC FLAGS_REG))])]
{
  if (<MODE_SIZE> < GET_MODE_SIZE (SImode))
    operands[0] = gen_lowpart (SImode, operands[0]);
})
  • bitcode已关闭。

有什么想法吗?

3 个答案:

答案 0 :(得分:0)

我在8.0中遇到了从xib文件加载视图控制器的错误。这帮助了我:

let controller = HomeViewController(nibName: "HomeViewController", bundle: NSBundle.mainBundle())

NSBundle.mainBundle()是帮助我的关键。默认情况下,他无法在包中找到xib文件

答案 1 :(得分:0)

我在Xcode 8.3.3和iOS 8.0中遇到了这个错误。

当开发人员创建UIWindow时会发生此错误。

如果您使用的是Swift 3.1,请使用:

self.window = UIWindow()
self.window?.makeKeyAndVisible()
self.window?.frame = UIScreen.main.bounds

self.window?.rootViewController = MyViewController(nibName: "MyViewController", bundle: Bundle.main)

答案 2 :(得分:-1)

您是在XIB或StoryBoard中自定义HomeViewController吗?

因为你没有使用它来加载HomeViewController对象

let rootView = HomeViewController(nibName: "HomeViewController", bundle: nil)

或自定义init方法

convenience init() {   
               self.init(nibName: "HomeViewController", bundle: nil)
   }

并像之前一样使用

let rootView = HomeViewController()
相关问题