0

在目标 ViewController 中启用Hero Framework时,应用程序会崩溃,无论它是通过代码还是故事板设置的。可能是什么原因?

控制台说:

*** 由于未捕获的异常“NSRangeException”而终止应用程序,原因:“*** -[__NSArray0 objectAtIndex:]: index 0 beyond bounds for empty NSArray”

代码中显示的错误是:

if (view as? UINavigationBar) == nil {
    // the Snapshot's contentView must have hold the cornerRadius value,
    // since the snapshot might not have maskToBounds set

    let contentView = snapshot.subviews[0]  // Error, index goes out of bounds here

    contentView.layer.cornerRadius = view.layer.cornerRadius
    contentView.layer.masksToBounds = true
}

为什么会发生?

4

0 回答 0