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

Facebook (iOS): Main Thread Checker: UI API called on a background thread: -[UIApplication canOpenURL:] #9

Closed
leshik opened this issue Nov 17, 2018 · 3 comments
Labels
enhancement New feature or request ios
Milestone

Comments

@leshik
Copy link

leshik commented Nov 17, 2018

On iOS, I'm getting

Main Thread Checker: UI API called on a background thread: -[UIApplication canOpenURL:]

in XCode when "Sign In with Facebook" dialog pops up. Shouldn't we wrap LoginManager calls in DispatchQueue.main.async { }?

For me this solved the issue...

@moberwasserlechner moberwasserlechner added the enhancement New feature or request label Nov 17, 2018
@moberwasserlechner
Copy link
Collaborator

Hi,

this plugin's iOS part was my first contact with Swift, so you're suggestions are very welcome.

Would it be possible for you to share the whole wrapping code, so I can change the docs.

thx & BR

@moberwasserlechner moberwasserlechner added this to the beta1 milestone Nov 17, 2018
@leshik
Copy link
Author

leshik commented Nov 17, 2018

I'm neither experienced with Swift, sorry – was just hit by the issue and then started looking for solutions at Stack Overflow.
I wrapped this part:

...
         DispatchQueue.main.async {
             self.loginManager!.logIn(readPermissions: [ ReadPermission.publicProfile ],
                                viewController: viewController, completion: { loginResult in
                                 switch loginResult {
                                 case .failed(let error):
                                     failure(error)
                                 case .cancelled:
                                     cancelled()
                                 case .success(let grantedPermissions, let declinedPermissions, let accessToken):
                                     success(accessToken.authenticationToken)
                                 }
             })
         }
...

@moberwasserlechner
Copy link
Collaborator

Tried the change with my app. FB still works. Thanks for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ios
Projects
None yet
Development

No branches or pull requests

2 participants