【发布时间】:2017-04-18 20:45:21
【问题描述】:
我有每个设备的快照测试。我想检查我在具有快照的特定模拟器上运行的测试。
所以例如我想测试当前的模拟器是 iPhone6sPlus9.2 因为我没有为我拥有的许多其他模拟器类型记录快照。
我尝试了很多变体,例如:
(lldb) po [[UIDevice currentDevice] platform]
x86_64
(lldb) po [[UIDevice currentDevice] hwmodel]
MacBookPro11,2
(lldb) po [[UIDevice currentDevice] platformType]
0x0000000000000002
(lldb) po [[UIDevice currentDevice] platformString]
iPhone Simulator
(lldb) po [[UIDevice currentDevice] model]
iPhone
(lldb) po [[UIDevice currentDevice] localizedModel]
iPhone
(lldb) po [[UIDevice currentDevice] systemName]
iPhone OS
(lldb) po [[UIDevice currentDevice] systemVersion]
9.2
(lldb) po [UIDevice currentDevice]
<UIDevice: 0x7fccf060a480>
(lldb) po [[UIDevice currentDevice] name]
iPhone Simulator // I WANT TO KNOW THAT IT IS IPHONE6SPLUS 9.2
还有来自这里的代码https://github.com/erica/uidevice-extension/
以及来自
的代码// UIDevice+YYAdd.h // YYKit https://github.com/ibireme/YYKit
但两者都返回不相关的值,例如设备类型的“x86”。
【问题讨论】:
-
不好。那是物理设备。我需要模拟器类型
-
我的回答对你有用吗?
标签: ios xctest uidevice fbsnapshottestcase