-
-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Main Thread Checker: UI API called on background thread. #3129
Comments
I don't think that what we need to fix. Any UI related task must be executed on main thread is a must know thing. |
Well, if its a known thing that all UI tasks must be executed on the main thread, why are you not making sure its all on there in your pod? It's a known thing that when a problem arises in code, you go through the due diligence to find the cause to prevent it from happening again. |
Well, that will make the library have code that's not its concern. |
Apple is warning for a reason - because something is not up to its expectations. Or its not perfect and needs help - it only discovers its on the background thread after execution. That's where you come in to fix it. |
Looking at Thread 12 in your screenshot, it looks like you are receiving information on a background thread and trying to update your chart from there. It is your responsibility to ensure that you're calling methods that update the visual representation of the Chart on the main thread, just as it's your responsibility to ensure all other UI calls are done on the main thread. If you feel this is not the case, you should file a bug report with Apple as almost none, if not none, of their UI calls are automatically rerouted to the main thread. |
Thank you @jjatie for helping me find the problem. I was too busy distracted by the code and not the threads on the left, which display the method being called that triggers the warning.... Was able to put that on the main thread to eliminate the warning. It was the clear method I was calling on the background while the graph was being drawn on the main. |
I got the following console log warning from using your chart. When I wrap it in a block to be executed on the main thread, I no longer get that warning. Would you be able to fix it on your end so I don't have to fork it?
The text was updated successfully, but these errors were encountered: