ximmyxiao
ximmyxiao

Reputation: 2801

why does lldb's po command can't print superview in dot?

If i want po subView's superview , when i use subView.superView , it will complaints not found , but if i use [subView superView] , the po command will works well ,what's reason behind this?

(lldb) po self.blackView.superview
error: property 'superview' not found on object of type 'UIView *'
error: 1 errors parsing expression
(lldb) po ((UIView*)self.blackView).superview
error: property 'superview' not found on object of type 'UIView *'
error: 1 errors parsing expression
(lldb) po [self.blackView superview]
<UIView: 0x15d53ce50; frame = (0 0; 375 667); autoresize = W+H; layer = <CALayer: 0x15d53cfc0>>

Upvotes: 0

Views: 304

Answers (1)

Jim Ingham
Jim Ingham

Reputation: 27110

They aren't really parsing issues in general, they tend to be "quality of type information" issues. In this case, superview is actually a property on the UIViewHierarchy category, and there's a bug in clang's debug info that causes it not to generate debug info for properties in categories. The compiler won't turn a property access into the method call unless it knows the type.

If you are using Xcode7, you can usually fix this type info problem for frameworks that use the clang "modules" feature (including most of the Apple frameworks) by instructing lldb to build the module for the framework of interest, which has much richer type information. You do this by issuing the lldb command:

(lldb) expr @import UIKit

Try running that before trying you expressions and see if that goes any better.

Upvotes: 2

Related Questions