-
Notifications
You must be signed in to change notification settings - Fork 110
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
Conversation
There was a problem hiding this 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.
Lock/ObserverStore.swift
Outdated
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove comment please
Lock/ObserverStore.swift
Outdated
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 { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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 functionalityFixes #565