My app freezes but no error appears My app freezes but no error appears ios ios

My app freezes but no error appears


It sounds like you've blocked the main thread somehow. To debug, run the app in the debugger and when the app freezes, hit the pause button above the log area at the bottom of Xcode. Then on the left side, you'll be able to see exactly what each thread is doing, and you can see where it's getting stuck.

pause button

Probably either a long loop on the main thread or a sync deadlock.


Top answer is correct. You can debug this with "Pause" option. Most common way to block main thread is to call dispatch_sync on the same thread you dispatching. Sometimes you call same code from dispatch_once.


Besides pausing and following the stacktrace I think as an additional thing to do, is to check in the code if there's any loop causing the app freezes.

I recently ran into a similar problem, but stack trace didn't help much, I figured out that I was having an eternal loop when calling a reloadData() inside layoutsubviews method and that was causing a freeze with no errors and no help from instruments.


matomo