Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I debug effectively with blocks in Xcode

Tags:

xcode

ios

I'm really struggling with debugging code on our big ios project. It seems like everyone has gone nuts on putting blocks and dispatch queues everywhere.

When I'm asked to debug a chunk of code, I really like to step through it and watch how things change, and see what is really happening with variables. I can't really do that easily with all the blocks that have been put in for two reasons:

  1. I have to put a breakpoint within each little block to stop in that block.

  2. Within a block, the variables from without the block are not displayed in a useable fashion, and can't be easily dumped to the console with a po command.

Is there an easier or better way to step through/evaluate code that is rife with blocks? Or am I missing something here?

like image 638
HalR Avatar asked Apr 05 '13 18:04

HalR


2 Answers

Do you use breakpoint with automatically console dump (without stopping your running app)?

There is a far from excellent, but really usable tutorial about intermediate debugging.

Happy coding!

like image 186
Balazs Nemeth Avatar answered Oct 20 '22 22:10

Balazs Nemeth


Why not use NSLog() to output needed variables in blocks?

like image 29
AndrewShmig Avatar answered Oct 20 '22 21:10

AndrewShmig