macOS Catalyst UIPasteboard Video

Hi!


I am trying to copy an mp4 or m4v video file to the general pasteboard and then paste it into iMessage.


let url = Bundle.main.url(forResource: "video", withExtension: "mp4")
let videoData = Data(contentsOf: url)
UIPasteboard.general.setData(videoData, forPasteboardType: "public.mpeg-4"


I can see the video is indeed in the pasteboard but it won't copy into iMessage. This is on macOS while developing an app using Catalyst.


Thanks

Anyone found any solution yet?

Had a similar issue and what was occurring is that the videoData line was not completing before the UIPasteboard. I ended up using DispatchGroup enter leave and wait. Forced the one action to complete before the next and then I was able to paste anywhere.

Completing the above I received the below on the wait() action that I am still researching. So if anyone has a better suggestion please reply.

warning run: Thread running at QOS_CLASS_USER_INTERACTIVE waiting on a lower QoS thread running at QOS_CLASS_DEFAULT. Investigate ways to avoid priority inversions

macOS Catalyst UIPasteboard Video
 
 
Q