iOS How to determine what is blocking the UI iOS How to determine what is blocking the UI ios ios

iOS How to determine what is blocking the UI


Try to Pause program execution (there is a button for that in bottom panel of Xcode, the third one)

Pause

  • Then look at left panel (Navigator panel),
  • Find Debug Navigator

Debug Navigator

  • Find thread with main function, and mb you can figure out by methods in this thread, what takes so long to update your UI. The method that are working right now is the top black one usually(with grey colour listed obj-c internal methods).

main


You can use the System Trace tool in Instruments by running your App in profile mode. Then you will get a detailed run down of all the threads in the system along with stack traces at each scheduling event the thread goes through.

There is a great video from the 2016 WWDC System Trace in Depth which will walk you through debugging a blocked thread issue.

This is much better than the Time Profiler instrument since, that tool works based off of taking samples of what is running on the CPU at intervals. However, if your thread is blocked, it isn't running on the CPU, so - it will not be sampled. You might have your main thread blocked for a whole second but it won't show up in Time Profiler.