Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIPasteboard.general.string takes too long

In my UI test, I have a test where I am using the UIPasteboard to throw the input around. Just before I use it, I store the current value of the pasteboard into a local temporary variable like so: let currentClipboard = UIPasteboard.general.string ?? "" and it will be restored again at the end of the test like so: UIPasteboard.general.string = currentClipboard. However, sometimes the let currentClipboard = UIPasteboard.general.string ?? "" line takes forever to complete, if at all. I've waited like 1-2 minutes and it still stuck there. I know this because I actually added a breakpoint right below that line and it was never called. Can anybody tell me what's wrong with my code? Thanks.

like image 969
Bawenang Rukmoko Pardian Putra Avatar asked Sep 18 '25 12:09

Bawenang Rukmoko Pardian Putra


1 Answers

I've faced the same issue in the simulator only. If you're testing in simulator then just reset the simulator and it'll start working fine. And I didn't find this type of issue in the real device.

like image 195
Kishan Barmawala Avatar answered Sep 20 '25 04:09

Kishan Barmawala