ios - UITableViewAlertForLayoutOutsideViewHierarchy错误: Warning once only (iOS 13 GM)

标签 ios swift tableview ios13

在执行 Segue 时,我在 iOS13 上遇到了一个奇怪的错误,我无法弄清楚它的含义,也找不到该错误的任何文档。问题是,这似乎会导致很多延迟(几秒钟),直到执行转场。

2019-09-11 22:45:38.861982+0100 Thrive[2324:414597] [TableView] Warning once only: UITableView was told to layout its visible cells and other contents without being in the view hierarchy (the table view or one of its superviews has not been added to a window). This may cause bugs by forcing views inside the table view to load and perform layout without accurate information (e.g. table view bounds, trait collection, layout margins, safe area insets, etc), and will also cause unnecessary performance overhead due to extra layout passes. Make a symbolic breakpoint at UITableViewAlertForLayoutOutsideViewHierarchy to catch this in the debugger and see what caused this to occur, so you can avoid this action altogether if possible, or defer it until the table view has been added to a window. Table view: ; layer = ; contentOffset: {0, 0}; contentSize: {315, 118}; adjustedContentInset: {0, 0, 0, 0}; dataSource: >

我正在使用 Hero,但我尝试禁用它并使用常规 Segue,但这并没有阻止延迟。

启动segue的代码是didSelectRowAt

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        if indexPath.section == 0 {
            selectedCell = realIndexFor(activeGoalAt: indexPath)
            performSegue(withIdentifier: "toGoalDetails", sender: nil)
        } else if indexPath.section == 1 {
            selectedCell = indexPath.row
            performSegue(withIdentifier: "toIdeaDetails", sender: nil)
        } else {
            selectedDecision = indexPath.row
            hero(destination: "DecisionDetails", type: .zoom)
        }
    }

然后,目标 VC 中的 viewDidLoad 或 viewWillAppear 中的任何代码都不会以任何方式影响这一点(我尝试将其全部注释掉,没有任何区别。

知道是什么原因造成的吗?我可以分享所需的任何其他详细信息。

谢谢。

最佳答案

这发生在我身上,因为我在 viewWillAppear(:) 方法中注册了用于更改方向通知的设备。 我将注册移到了 viewDidAppear(:) 中,并且 Xcode 不再在断点处停止。

我可以说的是,当 View 已经可见时,可能会运行布局更改......

关于ios - UITableViewAlertForLayoutOutsideViewHierarchy错误: Warning once only (iOS 13 GM),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57897288/

相关文章:

ios - 试图找出如何在 Swift 2.0 中加载多个图像序列

arrays - 如何构建对象层次结构,使所有名词都是单词但并非所有单词都是名词

iOS : how to programmatically auto layout a horizontal table view?

iphone - 如何防止 subview 的剪辑部分仍然发生触摸事件?

ios - NSLayoutAttribute中的Top和TopMargin有什么区别?

ios - NSUrlSession 在 Swift 中运行缓慢

swift - UITableViewCell 不显示数据

ios - 在 Swift 3 中设置 CABasicAnimation 委托(delegate)问题?

ios - NSInvalidArgumentException -[__NSCFString unsignedLongLongValue] : unrecognized selector sent to instance

ios - 发送到实例的 NSURL 无法识别的选择器