我遇到UIPageViewController崩溃:收到状态的CA回调,但活动状态队列为空。
答案 0 :(得分:0)
我遇到了同样的错误,这是因为用户翻页太快了,所以我不得不像这样降低用户的速度:
func pageViewController(_ pageViewController: UIPageViewController, willTransitionTo pendingViewControllers: [UIViewController]) {
pageViewController.view.isUserInteractionEnabled = false
}
然后在
func pageViewController(_ pageViewController: UIPageViewController, didFinishAnimating finished: Bool, previousViewControllers: [UIViewController], transitionCompleted completed: Bool) {
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.1, execute: {
pageViewController.view.isUserInteractionEnabled = true
})
}
如果您确定viewController速度很快,也可以忽略asynAfter。