How to retrieve the ios device screen resolution from the simctl command line

467 views Asked by At

I'm looking for a way to retrieve via the xcrun simctl command line the screen resolution of the devices.

I'v tried to list device types with xcrun simctl list -j devicetypes but unfortunately the resolution is not stored there...

Any idea?

1

There are 1 answers

2
Zaphod On BEST ANSWER

I found a way by digging, thanks to CodeBender solution, with xcrun simctl io

Use it this way (where the UDID is the device you want):

xcrun simctl io 80E6DAF5-A6EE-44F5-AAE6-561D58652C31 enumerate

It returns instantly this:

Port:
    UUID: 246D47F3-7BDA-42DE-B511-0C1BD0C1EBCF
    Class: Display
    Port Identifier: com.apple.CoreSimulator.IndigoFramebufferServices.Display
    Power state: On
    Display class: 0
    Default width: 640
    Default height: 1136
    Default pixel format: 'BGRA'
    Display rotation:
        Angle              = 0 radians