rubygemsrvmcalabashcalabash-iosrunloop

Calabash-ios console can't start with DEVICE_TARGET='iPhone 5 (9.2)'


I am trying to start the test server I am getting the below error. Could you please some one give me the solution. I tried different combination of gem versions but no luck. Appreciated quick help on this.

I am using command something like

DEVICE_TARGET='iPhone 5 (9.2)' calabash-ios console


irb(main):001:0> start_test_server_in_background

ArgumentError: Could not find a device with a UDID or name matching 'iPhone' from /Users/test/.rvm/gems/ruby-2.0.0-p353/gems/run_loop-2.1.1/lib/run_loop/device.rb:126:in device_with_identifier' from /Users/test/.rvm/gems/ruby-2.0.0-p353/gems/run_loop-2.1.1/lib/run_loop/device.rb:160:indetect_device' from /Users/test/.rvm/gems/ruby-2.0.0-p353/gems/run_loop-2.1.1/lib/run_loop/core.rb:71:in run_with_options' from /Users/test/.rvm/gems/ruby-2.0.0-p353/gems/run_loop-2.1.1/lib/run_loop.rb:134:inrun' from /Users/test/.rvm/gems/ruby-2.0.0-p353/gems/calabash-cucumber-0.18.1/lib/calabash-cucumber/launcher.rb:718:in block in new_run_loop' from /Users/test/.rvm/gems/ruby-2.0.0-p353/gems/calabash-cucumber-0.18.1/lib/calabash-cucumber/launcher.rb:716:intimes' from /Users/test/.rvm/gems/ruby-2.0.0-p353/gems/calabash-cucumber-0.18.1/lib/calabash-cucumber/launcher.rb:716:in new_run_loop' from /Users/test/.rvm/gems/ruby-2.0.0-p353/gems/calabash-cucumber-0.18.1/lib/calabash-cucumber/launcher.rb:584:inrelaunch' from /Users/test/.rvm/gems/ruby-2.0.0-p353/gems/calabash-cucumber-0.18.1/lib/calabash-cucumber/core.rb:943:in start_test_server_in_background' from (irb):1 from /Users/test/.rvm/rubies/ruby-2.0.0-p353/bin/irb:12:in'


Solution

  • UPDATE

    From your comment, it appears you are trying to launch on a physical device, not a simulator. This is confusing because "iPhone 5 (9.2)" has the same naming convention as a simulator.

    When you target a physical device, you need to use the UDID of the device, which you can find in the first few lines of output of instruments:

    $ xcrun instruments -s devices
    stern [4AFA58C7-5D39-54D0-9733-04302E7XXXXX]
    neptune (9.3.1) [43be3f89d9587e9468c24672777ff6241bdXXXXX]
    uranus (9.3.1) [6c3ed5434b5dfc29758f8835644b55bd43XXXXX]
    Apple TV 1080p (9.0) [D6875A98-2C0E-4138-85EF-841025A54DE0] (Simulator)
    # the rest are simulators.
    

    In the example above:

    * stern is the host computer.
    * neptune and uranus are physical devices.
    

    To target neptune:

    $ DEVICE_TARGET=43be3f89d9587e9468c24672777ff6241bdXXXXX \
      DEVICE_ENDPOINT=http://<ip of your device>:37265 \
      calabash-ios console
    

    If you name your devices sensibly, you can also do this:

    $ DEVICE_TARGET=neptune \
      DEVICE_ENDPOINT=http://<ip of your device>:37265 \
      calabash-ios console
    

    I suspect that because your physical device name exactly matches a simulator name, Calabash is confused about what device you want to target.

    To recap: You have two options:

     1. Use the UDID you get from instruments.
     $ DEVICE_TARGET=43be3f89d9587e9468c24672777ff6241bdXXXXX \
       DEVICE_ENDPOINT=http://<ip of your device>:37265 \
       calabash-ios console
    
     2. Rename your device to something like "iphone5"
     $ DEVICE_TARGET=iphone5 \
       DEVICE_ENDPOINT=http://<ip of your device>:37265 \
       calabash-ios console
    

    You might find the Testing on Physical Devices wiki page helpful.

    Previous Answer

    Have you tried "quotes?

    $ DEVICE_TARGET="iPhone 5 (9.2)" calabash-ios console
    

    ArgumentError: Could not find a device with a UDID or name matching 'iPhone' from

    For some reason, run-loop is missing the "5 (9.2)" portion of the string.

    The only other thing I can think of is that you don't have an iPhone 5 iOS 9.2 simulator installed. Do you see one in Xcode?

    You can also try using the UDID directly.

    # List the available simulators
    $ xcrun instruments -s devices
    <snip>
    iPhone 6 Plus (9.3) [D6AFEDFE-2E02-4A33-AEC8-740053DDC6DE] (Simulator)
    
     # Use the UDID directly.
     $ DEVICE_TARGET="D6AFEDFE-2E02-4A33-AEC8-740053DDC6DE" calabash-ios console