我目前正在使用FBSnapshotTestCase和Nimble-Snapshot为我的项目中的ViewControllers拍摄快照。
我知道在领域UI和快照测试中,Video Luis提到,我们可以跨设备测试视图(iPhone5、iPhone、6+等)。
我想知道我在模拟器中运行在哪个设备上,但是当我使用在这篇文章iOS: How to determine the current iPhone/device model in Swift?中找到的这个扩展打印出模型名称时
let modelName = UIDevice.current.modelName
它只会说我在模拟器中运行。
我在How to determine the device running in the simulator? 之后关注了这个堆栈溢出,但是使用FBSnapshotTestCase并不一定与“可用的功能”相关。有没有人遇到过类似的问题?
发布于 2020-12-29 03:22:42
看起来UIDevice.current.name会在模拟器上给你想要的东西。(However, on a device it will instead be what the owner has named their device in the settings)。
https://stackoverflow.com/questions/44597488
复制相似问题