推送视图时显示白屏

White screen shown when pushing view

推送视图控制器:

func showChatLogForTrainer(trainer: Trainers) {
    let chatLogVC = ChatLogVC(collectionViewLayout: UICollectionViewFlowLayout())
    self.navigationController?.pushViewController(chatLogVC, animated: true)
}

但是当 运行 应用程序时,它会在显示视图控制器之前显示一个白屏。它以前不这样做..但我没有触及视图的显示方式,所以不确定为什么现在要这样做。

ChatLogVC中的viewDidLoad

override func viewDidLoad() {
    super.viewDidLoad()
    self.navigationController?.setNavigationBarHidden(false, animated: false)
    self.collectionView?.backgroundColor = UIColor(red: 41/255, green: 38/255, blue: 45/255, alpha: 1);
    self.collectionView?.register(ChatMessageCell.self, forCellWithReuseIdentifier: cellId)
    self.collectionView?.alwaysBounceVertical = true
    self.collectionView?.contentInset = UIEdgeInsets(top: 8, left: 0, bottom: 8, right: 0)
    self.collectionView?.indicatorStyle = .white
    self.collectionView?.keyboardDismissMode = .interactive
}

It didn't used to do this.. but I haven't touched how the view is shown so not sure why it's doing it now.

您可以使用 git bisect 查找导致此问题的更改。

事实证明这是模拟器的一个错误。我已尝试清理和重建,以及将模拟器恢复为默认设置并重新启动模拟器,但白屏错误仍然存​​在。

但是当 运行 我的 phone 上的应用程序时,推送视图按预期工作!

Xcode 版本 8.2.1 (8C1002) - 模拟器版本 10.0 (SimulatorApp-726.7)