使用RubyMotion选择iOS模拟器设备类型

时间:2014-10-09 13:25:27

标签: ios iphone ios8 ios-simulator rubymotion

自iOS 8发布以来,模拟器的默认设备类型变为iPhone 6.即使我使用硬件手动更改设备类型>设备菜单,在下次启动时(使用rake simulator),模拟器将恢复为iPhone 6。

我想知道是否有任何rake选项或强制设备类型的其他设置。

PS。我知道有很多方法可以强制使用非视网膜iPhone和一种方式来启动iPad模拟器而不是iPhone模拟器,但我有兴趣在5/6/6 +之间进行选择。

由于

4 个答案:

答案 0 :(得分:18)

我发现最简单的方法是将以下内容添加到Rakefile

的末尾
desc "Run simulator on iPhone"
task :iphone4 do
    exec 'bundle exec rake device_name="iPhone 4s"'
end

desc "Run simulator on iPhone"
task :iphone5 do
    exec 'bundle exec rake device_name="iPhone 5"'
end

desc "Run simulator on iPhone"
task :iphone6 do
    exec 'bundle exec rake device_name="iPhone 6"'
end

desc "Run simulator in iPad Retina" 
task :retina do
    exec 'bundle exec rake device_name="iPad Retina"'
end

desc "Run simulator on iPad Air" 
task :ipad do
    exec 'bundle exec rake device_name="iPad Air"'
end

然后您可以在终端中运行rake iphone5,它将打开该设备的模拟器。

答案 1 :(得分:12)

为旧版Xcode运行/Applications/Xcode.app/Contents/Developer/usr/bin/simctl list(或/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/simctl list

显示你的模拟器 以下是我的模拟器设备

== Devices == -- iOS 7.0 -- -- iOS 7.1 -- iPhone 5s (971DB3D4-7FF4-4005-A11D-11541ED79193) (Shutdown) -- iOS 8.0 -- iPhone 5s (EE64F798-6CB9-40B1-8B19-30727C3CA538) (Shutdown) iPhone 6 Plus (D9F2BEEE-D341-4080-8A49-24AB6FACD9D9) (Shutdown) iPhone 6 (81229508-4D35-4BEE-B616-FB99FDC6BCDD) (Booted) iPad 2 (F2484155-E4A2-44E9-A113-AAF4B9A83717) (Shutdown) Resizable iPhone (B762046B-1273-4638-B0ED-A7827A822BDD) (Shutdown) Resizable iPad (AACAB77A-12BD-43F3-A847-3D11575F3BF3) (Shutdown)

如果您想将iPhone 5s作为IOS 7.1(You must set app.deployment_target = '7.1')运行,您可以像执行此操作 rake device_name="iPhone 5s (971DB3D4-7FF4-4005-A11D-11541ED79193)"

答案 2 :(得分:1)

在" Motion :: App"之前的rake文件中部分,执行以下操作

ENV['device_name'] ||= 'iPhone 4s'

或者在模拟器设备列表中指定任何其他设备的名称。

答案 3 :(得分:1)

在 2021 年测试,您只需要使用类似的东西:

rake device_name="iPad (8th generation)"