UITextView crash on iOS 18.4 beta

UITextView crash when setting attributed text that contains substring ffi and attributedText contains NSFontAttributeName, NSForegroundColorAttributeName

Reproducible case:

UITextView *textView = [[UITextView alloc] init];

textView.attributedText = [[NSAttributedString alloc] initWithString:@"ffi" attributes:@{ NSParagraphStyleAttributeName: [self createParagraphOfLineHeight:20], NSFontAttributeName: [UIFont systemFontOfSize:fontSize weight:UIFontWeightRegular], NSForegroundColorAttributeName: UIColor.black }];

You should probably raise this as a bug in the usual way. It won't really get progressed if it's only posted in these Developer Forums.

You need to raise each issue you find separately at https://feedbackassistant.apple.com/ You can post the FB numbers here if you want, so that others can link to them.

I tested in Swift something similar, without crash on simulator 18.4

          let string = "ffi"
          
          var style = [NSAttributedString.Key.foregroundColor: UIColor.black, NSAttributedString.Key.font: UIFont.systemFont(ofSize: 17, weight: .regular), NSAttributedString.Key.paragraphStyle: NSParagraphStyle.default.mutableCopy() as! NSMutableParagraphStyle]
     
          let attributeString = NSMutableAttributedString(string: string, attributes: style)
          testField.attributedText = attributeString

@neohoangokg There's not enough here to reproduce the issue.

Could you share a please share a link to a test project that reproduces the issue. That'll help us better understand what's going on. If you're not familiar with preparing a test project, take a look at Creating a test project.

The stacktrace.

We're also affected by the crash, here's two sample apps that demonstrate it:

https://github.com/plu/UITextViewCrash

FB16604342

Only happens on iOS 18.4 Beta - any other iOS version before that was fine.

In my case it happens on a letter combination that produces a ligature.

  1. Updating the font setting (this is done by our font provider) can help to fix it.
  2. Removing the ligature feature also help to fix it.

But I think there would be something wrong on iOS 18.4, please help to check it.

UITextView crash on iOS 18.4 beta
 
 
Q