Invalid parameter exception thrown by _UIQueuingScrollView Invalid parameter exception thrown by _UIQueuingScrollView ios ios

Invalid parameter exception thrown by _UIQueuingScrollView


Edit: after using this fix for more time, I can still see the bug on occasion so this isn't the complete fix (well... it was always kind of a hack). I'll update with the actual solution once I'll find it.


I've encountered this same error using UIPageViewController. After hours debugging the issue, I've found the cause was using UIView animations inside the completion handler of UIPageViewController's setViewControllers:direction:animated:completion:.

I don't know why animating at that stage causes the assertion error (I wasn't animating the UIPageViewController or its child view controllers), but wrapping the code block with dispatch_async on the main queue solves the issue and stop the crashing.


I saw this crash when trying to programmatically transition to a new page. An answer that made sense to me is to not allow them to touch the page view during the transition.

__block UIView *pageView = pageViewController.view;// Disable page view to not allow the user to interrupt the page view animation and cause crashpageView.userInteractionEnabled = NO;[pageViewController setViewControllers:@[viewController] direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:^(BOOL finished) {    if (finished) {        pageView.userInteractionEnabled = YES; // re-enable    }}];


I use UIPageViewController with Dots. After user swipes on the dots, the delegate didFinishAnimating get called and I trigger other animation, then it crashes. But it only happen when user swipes on the dots.

- (void)pageViewController:(UIPageViewController *)pageViewController didFinishAnimating:(BOOL)finished previousViewControllers:(NSArray<UIViewController *> *)previousViewControllers transitionCompleted:(BOOL)completed{    if (completed && finished)    {        dispatch_async(dispatch_get_main_queue(), ^{            [self animateSomeView];        })    }}