Re: Weird Problem, is this an XCode Bug?
Re: Weird Problem, is this an XCode Bug?
- Subject: Re: Weird Problem, is this an XCode Bug?
- From: Alex Zavatone <email@hidden>
- Date: Thu, 04 Feb 2016 19:54:22 -0500
On Feb 4, 2016, at 11:12 AM, Dave <email@hidden> wrote:
> Jeez, really? I need a broken debugger like a hole in the dead at the moment. Any idea what causes it and how to get rid of it? Using “po” won’t help as it’s a custom object, I need to look at the properties. Any ideas how I can do this?
OK. This is exactly what the autoDescribe category is meant for.
Sending it your way off line
In the debugger simply type this at a breakpoint:
po [myAwesomeObject autoDescribe]
And you’ll get something like this.
(lldb) po [indexPath autoDescribe]
2016-02-04 19:50:29.819 SWNDirect[76380:29705304] -[NSObject(AutoDescribe) autoDescriptionForClassType:] [Line 90] length
2016-02-04 19:50:29.819 SWNDirect[76380:29705304] -[NSObject(AutoDescribe) autoDescriptionForClassType:] [Line 90] row
2016-02-04 19:50:29.820 SWNDirect[76380:29705304] -[NSObject(AutoDescribe) autoDescriptionForClassType:] [Line 90] section
2016-02-04 19:50:29.820 SWNDirect[76380:29705304] -[NSObject(AutoDescribe) autoDescriptionForClassType:] [Line 90] item
2016-02-04 19:50:29.820 SWNDirect[76380:29705304] -[NSObject(AutoDescribe) autoDescriptionForClassType:] [Line 90] ab_item
2016-02-04 19:50:29.822 SWNDirect[76380:29705304] -[NSObject(AutoDescribe) autoDescriptionForClassType:] [Line 90] ab_group
[NSIndexPath {length: Q = 2;
row: q = 0;
section: q = 2;
item: q = 0;
ab_item: q = 0;
ab_group: q = 2;
}]
Instead of something like this:
(lldb) po indexPath
<NSIndexPath: 0xc000000000000216> {length = 2, path = 2 - 0}
You can even use it in your log statements:
GeofenceControllerSingleton.m:1337: DLog(@" %@", [[_geofenceObjects objectForKey:myKey] autoDescribe]);
All in all, I find it a major lack of consideration on Apple’s end to not have something like this (and better written) in the Cocoa libs. Apple and Objective-C tout object introspection, but Apple doesn’t hand you tools that let you spit out your object’s guts. We shouldn’t have to write this stuff. Really. It’s like selling a mechanic a car with no gauges.
Hope this helps.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden