I added a NSMapTable (ZHashMap) category with - (NSString *)description method, but when I use po, breakpoint is not hit and the description is not printed in that format I specified in it. How to override description?
Asked
Active
Viewed 26 times
0
johndoe
- 1,721
- 3
- 13
- 33
-
You shouldn't override methods in Objective-C categories, as the behavior is unpredictable and/or undefined. See https://stackoverflow.com/questions/5272451/overriding-methods-using-categories-in-objective-c. You could create your own category method (`-jsloop__description`) and call that, or subclass `NSMapTable` and override `description` (not recommended). What is it about the default `description` behavior that you'd like to change? – NSGod May 01 '19 at 19:42
-
Okay, I would go with custom method. I wanted to pretty print it in a table format similar to SQL query output. – johndoe May 02 '19 at 03:41