0

XCode 4 tip: specific breakpoints

Most iOS developers are probably aware of and use the “All Objective-C Exceptions” breakpoint. When your application is slammed by an exception, you’re shown where it took place via a dynamic-placed breakpoint.

This is awesome and about as far as I personally needed to go with breakpoints. Until I started getting a random one I was trying to track down.

In the middle of changing over part of a test bit of code I forgot I was using NSMutableDictionary and not NSMutableArray. I have classes calling each other in a chain and I forgot about one of the classes in the switch-over to my new system.

I was getting a [NSCFDictionary isEqualToString] exception in a UITableView delegate (cellForRowAtIndexPath – where the label is set). I was having a bugger time trying to locate that sucker.

I went to the breakpoints Navigator, and added a Symbolic Breakpoint (“-[NSCFDictionary isEqualToString]“) and left the module defaulted to nothing.

Ran it again, and BAM! I was shown exactly where I forgot to change some code over – saved me a ton of time. You can add symbolics as you find them… perhaps there is a way to breakpoint on any error – I’m not sure myself of that yet. But it rocks.

Popularity: 2%