Reputation: 1421
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.
Upvotes: 4
Views: 746
Reputation: 183
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.
Upvotes: 4