0

我正在iOS 15 模拟器上的Xcode 13 beta 版本 5中测试我的应用程序。有一个集合视图在调用时会产生错误。该方法在较低版本(即:iOS 14.2)中运行良好。我试图通过方案诊断(地址清理程序、线程清理程序、僵尸对象等)捕获有关错误的更多信息,并仔细检查我是否在适当的情况下使用了弱关键字,但没有成功。EXC_BADACCESS (code=2, address=0x7ffee930ef38)performBatchUpdates

有没有其他人在 Xcode 13 中的 iOS 15 上测试过类似的问题?这可能只是一个测试版问题吗?这是一些示例代码:

var heightConstraint: NSLayoutConstraint!
let loadingHeight: CGFloat = 100
let interItemSpacing: CGFloat = 8

func reloadCollectionView() {
    collectionView.reloadData()
    UIView.performWithoutAnimation { [weak self] in
        self?.collectionView.performBatchUpdates(nil, completion: { _ in
            self?.collectionView.collectionViewLayout.invalidateLayout()
            self?.updateHeight
        }
    }
}

func updateHeight() {
    if loading {
        heightConstraint.constant = loadingHeight
    } else {
        heightConstraint.constant = collectionView.collectionViewLayout.collectionViewContentSize.height - interItemSpacing
    }
}
4

0 回答 0