UILabel intrinsicContentSize crashes on iOS 12

410 views Asked by At

I'm updating my app to iOS 12 and in my subclass of UILabel, I'm getting a crash when I call

super.intrinsicContentSize

Commenting out the code leads to a crash at layoutSubviews(), presumably the next time it would query intrinsicContentSize.

I'm currently overriding it and the app runs just fine, but my labels are the wrong size.

Is anyone else having this issue?

1

There are 1 answers

0
zippoguy On

Found the issue. I had an attributed string that previously set the whole length to use no underline. In my migration I changed it to

attributedText.addAttribute(NSAttributedString.Key.underlineStyle, value:[], range: NSRange(location: 0, length: text.length))

I don't think it liked the empty array, despite that being what it specifically told me to change it to.