Sve*_*uer 2 iphone ios ios7 swift
我知道可以通过以下方式检索设备的型号名称:
let device: UIDevice = UIDevice.currentDevice()
println("device.model: \(device.model)")
Run Code Online (Sandbox Code Playgroud)
问题是这在模拟中运行时不起作用。结果将是:
device.model: iPhone Simulator
Run Code Online (Sandbox Code Playgroud)
它可以在设备上运行,但我想知道模拟器正在模拟哪个设备。
在模拟器上运行时如何获取设备型号名称?
@jcesarmobile在 Swift 中的回答:
ProcessInfo.processInfo.environment["SIMULATOR_MODEL_IDENTIFIER"]
Run Code Online (Sandbox Code Playgroud)
iPhone11,2例如iPhone Xs 的退货
| 归档时间: |
|
| 查看次数: |
4790 次 |
| 最近记录: |