Named pasteboard not working on MacCatalyst

Hi, I'm storing a string on a named UIPasteboard, and when reading it back, it comes as nil. It works fine on iOS, but on MacCatalyst it always returns nil.

I store it like that:

let p = UIPasteboard(name: UIPasteboard.Name(rawValue: "aaa"), create: true)!
p.string = "some text"
print("hasStrings: \(p.hasStrings)")
// hasStrings: true

and I read it like that:

let p = UIPasteboard(name: UIPasteboard.Name(rawValue: "aaa"), create: false)!
print("hasStrings: \(p.hasStrings)")
// hasStrings: false

I'm running the two pieces of code from two different methods of a UIViewController. Say I store the string in 'viewWillAppear', and read it back in 'viewDidAppear'.

Answered by Frameworks Engineer in 707342022

I can’t reproduce what you’re seeing with a Catalyst app; the hasStrings property is returning true for me in the second instance.

If you believe there is an error in the framework, please file a Feedback and attach a sample project that reproduces your issue.

Accepted Answer

I can’t reproduce what you’re seeing with a Catalyst app; the hasStrings property is returning true for me in the second instance.

If you believe there is an error in the framework, please file a Feedback and attach a sample project that reproduces your issue.

Named pasteboard not working on MacCatalyst
 
 
Q