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

promisekit: warning: wait() called on main thread! #372

Closed
jesuasir007 opened this issue Sep 1, 2021 · 5 comments
Closed

promisekit: warning: wait() called on main thread! #372

jesuasir007 opened this issue Sep 1, 2021 · 5 comments

Comments

@jesuasir007
Copy link

I have face this issues when calling the transaction or balance ,this will be delay our app ,anyone give me a solution for this ?
web3swift in swift 5

@skywinder
Copy link
Collaborator

can you provide examples to reproducw of the code and output log errors?

@dangell7
Copy link

dangell7 commented Sep 2, 2021

Its because your calling wait() in the main thread. Use dispatch.

DispatchQueue.global(qos: .userInitiated).async {
        let dispatchGroup = DispatchGroup()
        dispatchGroup.enter()
        // DO STUFF
        dispatchGroup.leave()
    }

Thats sorta what you do.

Or dont call wait and use a completion handler.

@jesuasir007
Copy link
Author

ok

@jesuasir007
Copy link
Author

I have run with background and main thread to return a data .

@skywinder
Copy link
Collaborator

@dangell7 thanks again for the help! would be happy to send you rewards from GitCoin grant program !

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

No branches or pull requests

3 participants