Undefined symbols for architecture x86_64 UIMarkupTextPrintFormatter Mac OS Catalyst

Getting the error at Linking phase of Running for using valid library class UIMarkupTextPrintFormatter:

Showing Recent Messages

Undefined symbol: _OBJC_CLASS_$_UIMarkupTextPrintFormatter


Validated all build and signing properties to be Defaulted.

Code works for iPad Simulator and Device.

Replies

Same issue here, issue still persists on Xcode 11.1

I also got the same error. Has anyone solved it?

Not yet, one thing I figgured out, when I comment out part of the code that is using: uimarkuptextprintformatter


It is working in that case. But as on documenation says, it should work on Mac OS (Catalyst)

Yes when I comment the code that uses uimarkuptextprintformatter works correctly. It's a big problem.

I relly hope someone from Apple will take have a look on this ...

Same problem here

Same issue here

I have the same problem. But I was able to get around it by using Swift's functions to convert html to attributed text and then use UISimpleTextPrintFormatter with the attributed text.


My original code:

let formatter = UIMarkupTextPrintFormatter(markupText: htmlString)
formatter.perPageContentInsets = UIEdgeInsets(top: 70.0, left: 60.0, bottom: 70.0, right: 60.0)
printController.printFormatter = formatter
printController.present(animated: true, completionHandler: nil)


Working on Catalyst (and iOS):

guard let printData = htmlString.data(using: String.Encoding.utf8) else { return }
do {
  let printText = try NSAttributedString(data: printData, options: [.documentType: NSAttributedString.DocumentType.html, .characterEncoding: String.Encoding.utf8.rawValue], documentAttributes: nil)

  let formatter = UISimpleTextPrintFormatter(attributedText: printText)
  formatter.perPageContentInsets = UIEdgeInsets(top: 70.0, left: 60.0, bottom: 70.0, right: 60.0)
  printController.printFormatter = formatter
  printController.present(animated: true, completionHandler: nil)
} catch {
  print(error)
}

However, the NSAttributedString(data: ) seems to be more sensitive to what you throw at it on Catalyst than on iOS. For example, did I have problems with tables that worked fine on iOS. So it is not a perfect solution.

Same here,

I'm using Xcode Version 11.3.1 (11C504)

it works fine in a simulator (iPad) or on my Iphone 11, but as soon as I build my project for macOS (Catalina 10.15.3) I got that strange compilation error :

Undefined symbol: _OBJC_CLASS_$_UIMarkupTextPrintFormatter


more details:

Undefined symbols for architecture x86_64:

"_OBJC_CLASS_$_UIMarkupTextPrintFormatter", referenced from:

objc-class-ref in PDFGenerator.o

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

Same issue.

Anyone resolved this?

I faced a similar issue, and for me it some unclean library which should have been deleted. A "Xcode -> Product -> Clean Build Folder" fixed the issue for me.
  • Strangely this worked for me :)

Add a Comment