I have a breakpoint set and want to print my UITextField's superview. I type po myTextField.superview
but I receive the following error:
error: instance method 'undoManager' has incompatible result types in different translation units ('id' vs. 'NSUndoManager *')
note: instance method 'undoManager' also declared here
error: 1 errors parsing expression
What does this mean and how can I print my superview? I found a link that provides a janky workaround in code: http://openradar.io/15890965, but I would like a better solution.
People of the world: I have an answer!
To dodge all UIKit errors: Before typing your po
statement, type the line -- expr @import UIKit
If you want to turn this on for your app globally, then add the following breakpoint in your app delegate:
Thanks to Craig Hockenberry and Steve Streza for the update (found here).
The solution I use to prevent this error while debugging is to explicitly cast everything.
In your case I would do
po [(UITextField *)myTextField superView]
Do you have any custom accessor methods for 'myTextField'? I have seen this same issue a number of times and it is usually caused by the po trying to print a property for an object that gets initialized the first time its getter is called. For example, if I try to run 'po self.imageView.contentMode' on a UITableViewCell I get that same error. Try moving your breakpoint to a point in the code where you know that 'myTextField' has been fully initialized.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With