I have some weird problem. On my Macbook M1, when i build my project, everythink working well on physical iPhone XS 14.4 and 8 14.0.1, also on simulator with iOS 14+. But when i run any simulator with older iOS than 14.0 my app crashing when setup attributedText. Here is my code:
guard let input = input else { return nil }
guard let data = input.data(using: String.Encoding.unicode, allowLossyConversion: true) else { return nil }
if let string = try? NSAttributedString(data: data, options: [NSAttributedString.DocumentReadingOptionKey.documentType : NSAttributedString.DocumentType.html], documentAttributes: nil).string
{
//Set color and font
let myAttribute = [ NSAttributedString.Key.foregroundColor: UIColor.white , NSAttributedString.Key.font: UIFont.systemFont(ofSize: 17.0) ]
let myAttrString = NSAttributedString(string: string, attributes: myAttribute)
return myAttrString
}
return nil
}
The crash is in this line:
if let string = try? NSAttributedString(data: data, options: [NSAttributedString.DocumentReadingOptionKey.documentType : NSAttributedString.DocumentType.html], documentAttributes: nil).string
for NSAttributedString i got error Thread 1: EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0) I have try run my App on Macbook Intel, and there everythink is ok on simulators with older iOS than 14.0. So this is for me weird. Should I throw the application on the App Store anyway, because the fault lies only in the simulator or, however, the users may have a problem? I tried various solutions from the Internet, I changed the NSAttributedString modifications, but the applications always crash in the same place.