Skip to content

Simulators with ( in name are not started after tns run ios --device <device_name> #2131

Closed

Description

@asterizk

I can't run tns emulate ios --device "iPad Pro (12.9 inch)"

Doing so results in the following message:
Starting iOS Simulator Unable to find device iPad Pro (12.9 inch). The valid device names are iPhone 5, iPhone 5s, iPhone 6, iPhone 6 Plus, iPhone 6s, iPhone 6s Plus, iPhone 7, iPhone 7 Plus, iPhone SE, iPad Retina, iPad Air, iPad Air 2

Expected result:

  • Starts 12.9" iPad simulator

This error occurs despite 'xcrun simctl list' outputting the 12.9" iPad as an option.

I believe I've tracked the root cause down to the fact that "iPad Pro (9.7 inch)" and the "iPad Pro (12.9 inch)" devices contain parentheses in their names, and the regex that parses the output of 'xcrun simctl list' doesn't expect those parentheses to be there:

var lineRegex = /^ ([^\(]+) \(([^\)]+)\) \(([^\)]+)\)( \(([^\)]+)\))*/;

That regex is contained in the following file: /usr/local/lib/node_modules/nativescript/node_modules/ios-sim-portable/lib/simctl.js.

I guess that means it's a problem with the ios-sim-portable module. I've got version 1.3.0 of it. I will file an issue with that project. In the meantime I'm working around it by manually adding devices to the device list in simctl.js:

            devices.push({
                            name: 'iPad Pro (9.7 inch)',
                            id: 'F123F133-F175-4FF4-ABA5-4A043EFCA810',
                            fullId: "com.apple.CoreSimulator.SimDeviceType.iPad Pro (9.7 inch)",
                            runtimeVersion: '10.0',
                            state: 'Shutdown'
                        });


            devices.push({
                            name: 'iPad Pro (12.9 inch)',
                            id: '07552BEF-F830-4561-912B-D760B0716935',
                            fullId: "com.apple.CoreSimulator.SimDeviceType.iPad Pro (12.9 inch)",
                            runtimeVersion: '10.0',
                            state: 'Shutdown'
                        });

...right before the return devices; statement.

Obviously that's a big hack and not a solution (the solution would involve fixing that regex), but at the present it allows me to launch my Nativescript app on the 12.9" iPad under emulation, which is pretty important for me because it's the only iOS platform my company actually supports at the moment.

Feel free to close this if issues in dependencies shouldn't be filed here. I just thought I might file it because it manifested itself while I was using 'tns' and it might help someone else out.

My config:
OS X 10.11.6
Xcode 8.0 (8A218a)
tns --version: 2.3.0
ios-sim-portable: 1.3.0
npm --version: 3.10.8
tsc --version: Version 2.0.3

Activity

  1. asterizk commented on Oct 14, 2016

    @asterizk
    Author

    Looks a lot like this: ios-control/ios-sim#197

  2. davecoffin commented on Dec 22, 2016

    @davecoffin

    @asterizk Do you need to reinstall nativescript after you add your workaround?

  3. asterizk commented on Dec 22, 2016

    @asterizk
    Author

    No, I don't think so, but, for what it's worth, I haven't tried it in a couple of months so it may no longer work... ? What are you seeing?

  4. biziosan commented on Feb 8, 2017

    @biziosan

    Hi, I've just installed NativeScript.

    iPad Air 2 is detected as a simulated device. The demo app starts just fine. iPad Pro (both types) is not detected.

  5. grasshoppermouse commented on Feb 14, 2017

    @grasshoppermouse

    iPad Pro also not detected on my setup. Annoying because the App submission process requires screenshots from the 12.9" Pro, and I just got a "Metadata Rejected" from Apple due to lack of accurate screenshots from that device.

  6. nraboy commented on Feb 20, 2017

    @nraboy

    Any news on this? Apple won't let me submit my app without iPad Pro pictures, but I can't simulate on iPad Pro.

  7. rosen-vladimirov commented on Feb 20, 2017

    @rosen-vladimirov
    Contributor

    @nraboy , @grasshoppermouse you can change the device type of your simulator by executing the following steps:

    1. Start the simulator
    2. From the top menu select Hardware -> Device -> iOS 10.1 -> iPad Pro (12.9 inch)
    3. After the simulator is currently running, execute your CLI command: tns run ios - CLI will respect the already running emulator.

    Hoep this helps.

  8. nraboy commented on Feb 20, 2017

    @nraboy

    That does not work @rosen-vladimirov. It never deploys the app even with the correct simulator running. Works for every simulator except iPad Pro.

  9. grasshoppermouse commented on Feb 20, 2017

    @grasshoppermouse

    @nraboy is correct: switching simulators first doesn't help; files still don't transfer and the app doesn't launch. I used the hack of @asterizk, and then it seemed to work. However, the simulator that started running was the iPad Pro (without the parentheses), which I believe is only available in iOS 9 (not at work so I can't check). It turns out this has the same screen size as the iPad Pro (12.9 inch). I submitted screen shots to the app store from the iPad Pro, and the app was approved.

  10. nraboy commented on Feb 20, 2017

    @nraboy

    @grasshoppermouse it didn't work for me.

    I'm pretty bummed right now because I worked hard on my application and Apple won't let me submit until I get iPad Pro images.

    @rosen-vladimirov any ideas here?

  11. tjvantoll commented on Feb 20, 2017

    @tjvantoll
    Contributor

    I confirmed this as well. Even if you launch the 12.9 emulator you are unable to deploy to it from the {N} CLI.

    As a temporary workaround until this problem can be addressed, your best bet is running your app on the “iPad Retina”, which gives you 1536 x 2048 screenshots, and then manually upsizing those screenshots to the required 2048 x 2732 size. Not ideal because you lose a bit of quality, but I’ve taken this approach before and had apps accepted.

  12. rosen-vladimirov commented on Feb 20, 2017

    @rosen-vladimirov
    Contributor

    @nraboy , @grasshoppermouse , @tjvantoll sorry for this issue 😿
    I'll raise it's priority and will try to take a look at the issue by the end of the week. Meanwhile can you provide the following information, while the iPad simulator is running:

    $ tns device --log trace
    $ xcrun simctl list devices
    

    As a workaround you may try the following:

    $ tns build ios --emulator
    

    This will build your application for iOS Simulator. Find the output in your platforms/iOS/<project name>/build/emulator/<project name>.app (the path may vary on your environment).

    After that, make sure your iOS Simulator (the problematic iPad one) is running and execute:

    $ xcrun simctl list devices | grep -i booted
    

    From this line get the identifier of the booted device.
    After that try the following:

    $ xcrun simctl install <device id> <path to .app>
    $ xcrun simctl launch <device id> <app identifier>
    
  13. 12 remaining items

  14. added this to the 3.1.0 milestone on Apr 27, 2017
  15. pkoleva commented on May 4, 2017

    @pkoleva
    Contributor

    Hey, @asterizk ,

    The main issue is that so far we've used other logic for starting simulators/deploying on them. With the changes ( in our 3.0.0 release and the RC before that) we weren't sure what will be useful to you, our users, so for iOS we haven't decided how to start simulators by their name. You can start any existing simulator by id ( tns run ios --device <device identifier>), which you can check by executing tns devices ios --available-devices. Hope this helps :)

  16. removed this from the 3.1.0 milestone on Jun 6, 2017
  17. pkoleva commented on Jul 14, 2017

    @pkoleva
    Contributor

    Related to #1548
    We still need to figure out the proper way to start specific simulators

  18. added this to the 4.0.1 milestone on Apr 16, 2018
  19. reopened this on Apr 23, 2018
  20. dtopuzov commented on Apr 25, 2018

    @dtopuzov
    Contributor

    Fixed in 4.0.1 RC (4.0.1-2018-04-23-11424).
    Now you can do things like this:

    tns run ios --device 'iPad Pro (12.9-inch) (2nd generation)' --sdk 11.3
    

    To see all available devices and sdks run this:

    tns device ios --available-devices
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions