How to check device id of iPhone simulator?

前端 未结 8 1331
耶瑟儿~
耶瑟儿~ 2020-12-24 05:16

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

8条回答
  •  难免孤独
    2020-12-24 06:01

    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:

    $ 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 .bashrc or .zshrc:

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

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

提交回复
热议问题