デバイスごとのスナップショット テストがあります。スナップショットがある特定のシミュレーターで実行していることをテストで確認したいと思います。
たとえば、現在のシミュレーターが 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」などの無関係な値を返しています。