Not able to use debug view hierachy

2019-07-08 16:56发布

问题:

I am currently trying my best to debug my application in Objective-C with the newest version of Xcode7.3 I really need to use Debug View Hierarchy but I am getting an error :

Assertion failure in -[UITextView _firstBaselineOffsetFromTop], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.60.7/UITextView.m:1683

If someone knows how to resolve this ! Thx

回答1:

This is a bug from Apple. There is a radar issue open : https://openradar.appspot.com/25311044



回答2:

A workaround to resolve this issue. Strictly in debug mode.

@interface UITextView(MYTextView)
@end

@implementation UITextView (MYTextView)
- (void)_firstBaselineOffsetFromTop {}
- (void)_baselineOffsetFromBottom {}

@end

For swift

extension UITextView {
    func _firstBaselineOffsetFromTop() {}
    func _baselineOffsetFromBottom() {}
}


回答3:

You can implement the method

- (void)_firstBaselineOffsetFromTop {}

in a UITextView category