【发布时间】:2015-02-20 22:27:31
【问题描述】:
所以我正在为此操作编写测试,如果它失败了,我们会懒惰地尝试使用 performSelector:withObject:afterDelay: 再次执行此操作,现在我想等待我的 runloop在测试中触发这个 performSelector 在拆除测试之前。这基本上归结为让 runloop 保持更多时间。
我找到了
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:delta]];
有用而且效果很好。
有没有更好的方法来做到这一点??
【问题讨论】:
-
XCTest 现在支持异步测试。查看文档。
标签: ios macos xctest nsrunloop performselector