When I'm trying to copy a text from the FMP (FileMakerPro) and paste it to any textfield of my app, I'm getting asian symbols instead of copied text.
It happens both when I'm launching a MacOS app, or an iOS app in the simulator.
Seems like the FMP uses some kind of RTF the app cannot recognize.
I tried to check the text from the pasteboard in different methods of a custom textfield class like shouldChangeCharactersIn of UITextFieldDelegate, or in textPasteConfigurationSupporting of UITextPasteDelegate, but I'm always getting symbols
Pasting the same text into a SearchBar or any Text Field of any other apps like Slack, Apple Music, Browser works well.
Also, Copy/Paste works well in app too when I'm copying RTF from browser, pdf files with different languages and rich text, so I'm not sure how to track the issue
I was able to fix it on the iPad and tested on a simulator:
let pasteBoard = UIPasteboard.general
let options: [NSAttributedString.DocumentReadingOptionKey : Any] = [
.documentType: NSAttributedString.DocumentType.rtf
]
if
let data = pasteBoard.data(forPasteboardType: "public.rtf"),
let attString = try? NSAttributedString(data: data,
options: options, documentAttributes: nil){
return attString
}
But this code doesn't work on Mac OS. The app just stucks at this line
let data = pasteBoard.data(forPasteboardType: "public.rtf"),
I was hoping to use NSPasteBoard to do the same trick, but NSPasteBoard is not allowed for Catalyst.
Is there any way to fix it or I need to file a ticket for that bug?