0
我有每個設備的快照測試。我想檢查我的測試是否在特定的具有快照的模擬器上運行。如何檢查我是否在iPhone6s Plus模擬器上運行
因此,例如我想測試當前的模擬器是iPhone6sPlus9.2 ,因爲我沒有記錄許多其他模擬器類型的快照。
我試着像很多變化:從這裏https://github.com/erica/uidevice-extension/
和
//的UIDevice + YYAdd.h // YYKit https://github.com/ibireme/YYKit代碼
(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
而且代碼
但都返回不相關的值,如設備類型的「x86」。
http://stackoverflow.com/questions/26028918/ios-how-to-determine-iphone-model-in- swift – ColdSteel
不好。那是物理設備。我需要模擬器類型 –
我的答案是否適合您? –