问题
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.
Is there any way to find device id without using codebase?
回答1:
EDIT: See other answers for the newer ways to view UDIDs for CoreSimulator
-based simulators.
instruments -s devices
xcrun simctl list
- From Xcode: Window -> Devices and Simulators -> Simulators.
The
Identifier
value is the UDID.
From 2011:
Is the iPhone Simulator UDID unique for each installed instance?
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.
This is the exact Terminal command you can enter to view it:
system_profiler SPHardwareDataType
回答2:
Try this
instruments -s devices
回答3:
As so often, there is a Xcode terminal tool for that (part of the Xcode tools) see xcrun manpage
xcrun simctl list | egrep '(Booted)'
lists only all booted (could be more than one) Simulators
(remove | egrep '(Booted)'
to see them all).
UIID results like
iPhone 6 Plus (AAAABD40-9DE6-44B7-A4EA-B34ABCDEFCA6) (Booted)
you can then lookup a folder in ~/Library/Developer/CoreSimulator/Devices
on your Mac and find all the "belongings" of that particular Simulator
回答4:
Xcode -> Window -> Devices and Simulators -> Select Device for which you want identifier (Inside details you can see identifier)
回答5:
You can also retrieve the same UDID, labeled as "Identifier". In the Xcode Window menu, select Devices and Simulators: then select the Simulators tab:
回答6:
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).
回答7:
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.
来源:https://stackoverflow.com/questions/6952279/how-to-check-device-id-of-iphone-simulator