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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix iOS 13.x Bug - Calling UI on non-main thread #576

Merged
merged 2 commits into from
Oct 3, 2019

Conversation

pixeled
Copy link
Contributor

@pixeled pixeled commented Oct 2, 2019

Changes

basically, controller.presentingViewController was being called/evaluated from non-main thread.
in iOS 13.1.x, they REALLY don’t like that - even if it’s just “inspection”

my app was rejected because the login view wasn’t being dismissed

this PR fixes that - basically just moves the evaluation down into the actual execution of the Queue.main without loss of functionality

Fixes #565

@pixeled pixeled requested a review from a team October 2, 2019 02:16
@cocojoe cocojoe changed the title fixes iOS 13.1.2 bug - but it always was 'wrong' Fix iOS 13.x Bug - Aggressive thread checker delay Oct 2, 2019
Copy link
Member

@cocojoe cocojoe 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 the PR, I was thinking about doing something similar.

return { controller.dismiss(animated: true, completion: completion) }
private func dismiss(from sub: UIViewController?, completion: @escaping () -> Void) -> () -> Void {
return {
//controller?.presentingViewController has to be INSIDE Queue.main.async
Copy link
Member

Choose a reason for hiding this comment

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

Remove comment please

private func dismiss(from controller: UIViewController?, completion: @escaping () -> Void) -> () -> Void {
guard let controller = controller else { return completion }
return { controller.dismiss(animated: true, completion: completion) }
private func dismiss(from sub: UIViewController?, completion: @escaping () -> Void) -> () -> Void {
Copy link
Member

Choose a reason for hiding this comment

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

Rename sub to controller please, is explicit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok.. i never liked swift’s BAD engineering practice of let name = name - because it’s just plain ugly & confusing.

@pixeled pixeled changed the title Fix iOS 13.x Bug - Aggressive thread checker delay Fix iOS 13.x Bug - Calling UI on non-main thread Oct 2, 2019
@cocojoe cocojoe merged commit 585b390 into auth0:master Oct 3, 2019
@cocojoe cocojoe added this to the vNext milestone Oct 3, 2019
@cocojoe cocojoe mentioned this pull request Oct 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UI API called from background thread
2 participants