ios 如何检查iPhone模拟器的设备ID?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6952279/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 20:58:53  来源:igfitidea点击:

How to check device id of iPhone simulator?

iosiphoneios-simulator

提问by Mrunal

I want to check device id for my iPhone simulator application. But not using codebase. I know the way how to do with codebase, using UIDevice instance.

我想检查我的 iPhone 模拟器应用程序的设备 ID。但不使用代码库。我知道如何使用 UIDevice 实例处理代码库。

Is there any way to find device id without using codebase?

有没有办法在不使用代码库的情况下找到设备 ID?

回答by Stefano

Try this

尝试这个

instruments -s devices

回答by TiBooX

As so often, there is a Xcode terminal toolfor that (part of the Xcode tools) see xcrunmanpage

通常,有一个Xcode 终端工具Xcode 工具的一部分),请参阅xcrun联机帮助页

xcrun simctl list | egrep '(Booted)'

lists only all booted (could be more than one) Simulators (remove | egrep '(Booted)'to see them all).

仅列出所有已启动的(可能不止一个)模拟器(删除| egrep '(Booted)'以查看全部)。

UIID results like

UIID 结果如

 iPhone 6 Plus (AAAABD40-9DE6-44B7-A4EA-B34ABCDEFCA6) (Booted)

you can then lookup a folder in ~/Library/Developer/CoreSimulator/Deviceson your Mac and find all the "belongings" of that particular Simulator

然后,您可以在~/Library/Developer/CoreSimulator/DevicesMac 上查找文件夹并找到该特定模拟器的所有“所有物”

回答by TiBooX

EDIT: See other answers for the newer ways to view UDIDs for CoreSimulator-based simulators.

编辑:有关查看CoreSimulator基于模拟器的UDID 的较新方法的其他答案。

  1. instruments -s devices
  2. xcrun simctl list
  3. From Xcode: Window -> Devices and Simulators -> Simulators. The Identifiervalue is the UDID.
  1. instruments -s devices
  2. xcrun simctl list
  3. 从 Xcode:窗口 -> 设备和模拟器 -> 模拟器。该Identifier值是 UDID。

From 2011:

从 2011 年开始:

Is the iPhone Simulator UDID unique for each installed instance?

每个安装的实例的 iPhone 模拟器 UDID 是唯一的吗?

This answer should be what you want. Look at System Profiler on your mac and the id is there. I just tested on my machine and the IDs match.

这个答案应该是你想要的。在您的 Mac 上查看 System Profiler,ID 就在那里。我刚刚在我的机器上测试过,ID 匹配。

This is the exact Terminal command you can enter to view it:

这是您可以输入以查看它的确切终端命令:

system_profiler SPHardwareDataType

回答by vishaalkolhe

Xcode -> Window -> Devices and Simulators -> Select Device for which you want identifier (Inside details you can see identifier)

Xcode -> Window -> Devices and Simulators -> Select Device which you want identifier (Inside details you can see identifier)

回答by Zack

You can also retrieve the same UDID, labeled as "Identifier". In the Xcode Window menu, select Devices and Simulators: enter image description herethen select the Simulators tab: enter image description here

您还可以检索相同的 UDID,标记为“标识符”。在 Xcode Window 菜单中,选择 Devices and Simulators: 在此处输入图片说明然后选择 Simulators 选项卡: 在此处输入图片说明

回答by Eric Wiener

You can search for just the booted devices and get the iOS version (different from @TiBooX's answer which just shows the active devices). You also don't need to use grep, you can just use the built in functionality of xcrun:

您可以仅搜索已启动的设备并获取 iOS 版本(与仅显示活动设备的@TiBooX 的答案不同)。您也不需要使用grep,您只需使用以下内置功能即可xcrun

$ xcrun simctl list 'devices' 'booted'

Which will print out something like:

这将打印出如下内容:

== Devices ==
-- iOS 10.3 --
-- iOS 11.4 --
-- iOS 12.4 --
-- iOS 13.4 --
    iPhone 11 Pro (A5DEEA78-1E82-472E-B7CC-FFD27741CDA2) (Booted)
-- tvOS 13.4 --
-- watchOS 6.2 --

I would recommend adding the following alias to your .bashrcor .zshrc:

我建议将以下别名添加到您的.bashrcor .zshrc

# Get the active simulator with
alias active-sims="xcrun simctl list 'devices' 'booted'"

This way you can just run active-simswithout remembering the entire line every time.

这样你就可以active-sims不用每次都记住整行了。

回答by candyman888

You can visually review the value in the simulator by navigating to home/Settings/General/About/Serial Number which is the same as your desktop machine. You can verify this by navigating to Apple/About This Mac and clicking the OS version number under OS X (the display will change to indicate your UDID - you may need to click it twice).

您可以通过导航到与您的台式机相同的 home/Settings/General/About/Serial Number 来直观地查看模拟器中的值。您可以通过导航到 Apple/About This Mac 并单击 OS X 下的操作系统版本号来验证这一点(显示将更改以指示您的 UDID - 您可能需要单击它两次)。

回答by Weidian Huang

There is another way without using command line, inside this plist file ~/Library/Developer/CoreSimulator/Devices/device_set.plist, it lists down all the devices with UUID.

还有一种不使用命令行的方法,在这个 plist 文件 ~/Library/Developer/CoreSimulator/Devices/device_set.plist 中,它列出了所有带有 UUID 的设备。