Xcode:哪个设备是模拟器运行的?使用FBSnapshotTestCase和Nimble-Snapshot比较设备之间的视图

时间:2017-06-16 20:28:16

标签: ios swift xcode fbsnapshottestcase

我目前正在使用FBSnapshotTestCase和Nimble-Snapshot在我的项目中拍摄ViewControllers的快照。

我知道在Realm UI和快照测试中Video Luis提到我们可以跨设备测试视图(iPhone5与iPhone 6+等)。

我想知道我在模拟器中运行的设备,但是当我使用此帖子iOS: How to determine the current iPhone/device model in Swift?上找到的此扩展程序打印出模型名称时 let modelName = UIDevice.current.modelName

它只会说我在模拟器中运行。

我正在关注此Stack Overflow帖子How to determine the device running in the simulator? ,但使用FBSnapshotTestCase并不一定与"可用的功能"有关。有没有人遇到类似的问题?

1 个答案:

答案 0 :(得分:0)

看起来 UIDevice.current.name 会为您提供有关模拟器的内容。 (However, on a device it will instead be what the owner has named their device in the settings)。