【问题标题】:tvOS 13 DiffableDataSource Invalid parameter not satisfying: itemCounttvOS 13 DiffableDataSource 无效参数不满足:itemCount
【发布时间】:2020-11-28 04:34:03
【问题描述】:

在启动我的 tvOS 应用程序时,我遇到了与 DiffableDataSource 相关的崩溃:Thread 1: Expection: "Invalid parameter not satisfying: itemCount"

发生在dataSource.apply(snapshot)线上。

当尝试在 Xcode 12 beta 4 上运行它时,我遇到了以下崩溃:

Thread 1: "Invalid update: invalid number of sections. The number of secxtions contained in the collection view after the update (1) must be equal to the number of sections contained in the collection view before hte update (1), plus or minus the number of sections inserted or deleted (1 inserted, 0 deleted)."

哪个更详细,但仍然没有提供有关为什么会发生这种情况的信息。

相同的代码在 iOS 上运行良好。

为什么会发生这种情况?

【问题讨论】:

    标签: swift tvos diffabledatasource


    【解决方案1】:

    这种情况下的解决方案是将数据源代码移出viewDidLoad 并移入viewDidAppear

    它看起来与某些时间问题或 tvOS 上的某些东西有关,并且看起来确实是 SDK 中的错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-03-20
      • 2012-02-14
      • 2021-07-20
      • 2013-09-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多