Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible fix for setViewController crash #139

Merged
merged 1 commit into from
Apr 27, 2017

Conversation

justinswart
Copy link
Contributor

We've been seeing a number of crashes with the following message:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: [views count] == 3'

Pretty much all searches for this type of crash suggest that the call to UIPageViewController setViewControllers(_:direction:animated:completion:) is not happening on the main thread.

Example: http://stackoverflow.com/questions/24000712/pageviewcontroller-setviewcontrollers-crashes-with-invalid-parameter-not-satisf

I've not been able to reproduce this but according to Hockey it seems to be happening frequently enough on app startup for it to be something we'd want to solve.

I added a symbolic breakpoint to trace the first call to -[UIPageViewController setViewControllers:direction:animated:completion:] at startup and it appears to be this one so suggestion is that we try wrapping it in Dispatch.main.async to see if it alleviates the issue on Hockey.

It's worth pointing out that we've had some strange successes with this before 馃

Copy link
Contributor

@mbrandonw mbrandonw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for putting this together!

I hope screenshot tests still pass!

@mbrandonw mbrandonw merged commit 65184b4 into master Apr 27, 2017
@mbrandonw mbrandonw deleted the discovery-page-vc-crash-fix branch April 27, 2017 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants