Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/94.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UIPasteboard.general.string花费的时间太长_Ios_Swift_Xcuitest - Fatal编程技术网

Ios UIPasteboard.general.string花费的时间太长

Ios UIPasteboard.general.string花费的时间太长,ios,swift,xcuitest,Ios,Swift,Xcuitest,在我的UI测试中,我有一个使用UIPasteboard来抛出输入的测试。在使用之前,我将粘贴板的当前值存储到一个本地临时变量中,如下所示:let currentClipboard=UIPasteboard.general.string??“”并且它将在测试结束时再次恢复,如下所示:UIPasteboard.general.string=currentClipboard。但是,有时让currentClipboard=UIPasteboard.general.string??“”行需要很长时间才能完

在我的UI测试中,我有一个使用UIPasteboard来抛出输入的测试。在使用之前,我将粘贴板的当前值存储到一个本地临时变量中,如下所示:
let currentClipboard=UIPasteboard.general.string??“”
并且它将在测试结束时再次恢复,如下所示:
UIPasteboard.general.string=currentClipboard
。但是,有时让currentClipboard=UIPasteboard.general.string??“”行需要很长时间才能完成,如果有的话。我等了1-2分钟,它仍然卡在那里。我知道这一点,因为我实际上在这一行的正下方添加了一个断点,但它从未被调用。有人能告诉我我的代码出了什么问题吗?谢谢。

我只在模拟器中遇到过同样的问题。
如果您在模拟器中进行测试,那么只需重置模拟器,它就会开始正常工作。我在实际设备中没有发现此类问题。

IC。谢谢你的回答。你是对的,它只发生在模拟器中,因为它只是用于测试。但即使我重启了很多次模拟器,它仍然会发生。