Calabash-ios 控制台无法以 DEVICE_TARGET='iPhone 5 (9.2)' 启动

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

我正在尝试启动测试服务器,但出现以下错误。 你能请某人给我解决方案吗?我尝试了 gem 版本的不同组合,但没有成功。 感谢对此的快速帮助。

我正在使用类似

的命令
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'

更新

根据您的评论,您似乎正试图在 物理 设备而非模拟器上启动。这令人困惑,因为 "iPhone 5 (9.2)" 与模拟器具有相同的命名约定。

当您以物理设备为目标时,您需要使用设备的 UDID,您可以在 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.

在上面的例子中:

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

目标海王星:

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

如果您合理地命名您的设备,您也可以这样做:

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

我怀疑因为您的物理设备名称 完全匹配 模拟器名称,所以 Calabash 对您要定位的设备感到困惑。

回顾一下:您有两个选择:

 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

您可能会发现 Testing on Physical Devices 维基页面很有帮助。

上一个答案

您尝试过"引用吗?

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

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

出于某种原因,运行-loop 缺少字符串的“5 (9.2)”部分。

我唯一能想到的是你没有安装 iPhone 5 iOS 9.2 模拟器。你在 Xcode 中看到一个吗?

您也可以尝试直接使用UDID。

# 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