Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

My app freezes but no error appears

Does any body know what I have to check if my app freezes? I mean, I can see the app in the iPad screen but no buttons respond. I have tried debugging the code when I click on the button, but I haven't seen anything yet. I was reading about the Instruments tools; specifically how do I use them?

Can anybody help me? I just need an explanation about how use the tools.

like image 713
Vanjo Avatar asked Apr 17 '12 17:04

Vanjo


People also ask

How to debug iOS app freeze?

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. Probably either a long loop on the main thread or a sync deadlock.

How do you unfreeze an app?

Force stop a frozen app: You should force stop the faulty apps. To do this, go to the settings of your phone> Apps> tap on the app> tap on Force Stop> confirm.


2 Answers

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.

like image 134
Ben Baron Avatar answered Oct 05 '22 18:10

Ben Baron


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.

like image 43
Timur Bernikovich Avatar answered Oct 05 '22 16:10

Timur Bernikovich