"[plugin] AddInstanceForFactory: No factory registered for id" - nothing to do with Audio

Viewed 2395

I have an otherwise empty and newly created UIKit project that just has a single UIViewController displaying on launch. It's using the 'Main.Storyboard'.

That View Controller has a UITextView which is linked to the code as an IBOutlet.

@IBOutlet private weak var textView: UITextView!

I am using the following code to render HTML as an AttributedString in that UITextView.

private func loadAndRenderHTMLAsAttributedText()
{
    if let htmlFile = Bundle.main.path(forResource: "SBC", ofType: "html")
    {
        let htmlString = try? String(contentsOfFile: htmlFile, encoding: String.Encoding.utf8)

        let data       = Data(htmlString!.utf8)
        
        if let attributedString = try? NSAttributedString(data: data,
                                                          options: [.documentType: NSAttributedString.DocumentType.html],
                                                          documentAttributes: nil)
        {
            self.textView.attributedText = attributedString
        }
    }
}

I'm getting this in the console when the 'self.textView...' line is executed:

020-11-08 19:26:24.829639+0000 testHTML[63645:6899666] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x600000839000> F8BB1C28-BAE8-11D6-9C31-00039315CD46

All answers here and found via google searching are to do with AVAudioPlayer.

However, if I remove all the safety and force unwrap everything, then I don't get the console error:

private func loadAndRenderHTMLAsAttributedText()
{
    let htmlFile         = Bundle.main.path(forResource: "SBC", ofType: "html")
    let htmlString       = try? String(contentsOfFile: htmlFile!, encoding: String.Encoding.utf8)
    let data             = Data(htmlString!.utf8)
    let attributedString = try? NSAttributedString(data: data,
                                                   options: [.documentType: NSAttributedString.DocumentType.html],
                                                   documentAttributes: nil)
    
    self.myTextView.attributedText = attributedString
}
0 Answers
Related