1

I am getting this error even though my UI updates on

DispatchQueue.main.async {
} 

I tried to find out the thing which is causing this warning and freezes the app. I am attaching screenshot for more details. Can anyone help to figure out the issue? I tried to look on this Main Thread Checker: UI API called on a background thread: -[UIApplication delegate] Freezes the application and this Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState] but it didn't help.

enter image description here

  • 2
    code is required – SPatel Jan 29 '20 at 07:38
  • If you click on the runtime issue in the left menu it will show you the code that is causing the Main Thread checker warning. This line of code should be called on the main thread. For me it was a UIViewController initialisation called from a background thread. Once I put it into a `DispatchQueue.main.async { }` block it went away. – Chiara Jan 29 '20 at 07:56
  • @Chiara yes I checked that nothing is there without dispatch –  Jan 29 '20 at 08:27
  • Can you please post the code inside the block? – Chiara Jan 29 '20 at 08:32
  • There is nothing I am using which is causing this error. How can I share the code block –  Jan 29 '20 at 08:36
  • Just copy paste the code that you see when you click this warning, it might give us a clue... – Chiara Jan 29 '20 at 08:52
  • I doesn't get me to anywhere when I click the warning and also can't open it in `Navigator` –  Jan 29 '20 at 08:53
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/206837/discussion-between-chiara-and-niraj-ios). – Chiara Jan 29 '20 at 09:17
  • BTW, from Xcode’s “Product” menu, choose “Scheme” » “Edit Scheme...” (or press command+shift+`<`, and then choose “Run” » “Diagnostics”. There you will see a tiny little arrow button, ➡, to the right of the “Main Thread Checker” option, which you can tap and it will add a “Main Thread Checker” breakpoint for any of these “main thread checker” violations. Then run the code and manifest the problem again. Sometimes this can drop you in your code where this problem initiated. It might not identify the problem in this case, but is a useful tip for future readers who get these sorts of issues. – Rob Jan 31 '20 at 00:44

1 Answers1

0

Try updating the FirebaseAnalytics to a newer version (at least 4.0.0) which contain fixes in the framework for the UI thread checker.

Chiara
  • 398
  • 5
  • 10