@@ -87,24 +87,40 @@ def pre_build_actions(platform)
87
87
end
88
88
target ||= App . config . sdk_version
89
89
90
- family_int =
90
+ # May be overridden on Xcode <= 5 with the `device_family' option (see below)
91
+ #
92
+ # TODO This argument is required for the `sim` tool, but it's ignored for
93
+ # Xcode >= 6. We should get rid of it at some point.
94
+ #
95
+ family_int = App . config . device_family_ints [ 0 ]
96
+
97
+ xcode_version = Motion ::Util ::Version . new ( App . config . xcode_version . first )
98
+ if xcode_version >= Motion ::Util ::Version . new ( '6' )
99
+ if ENV [ 'device_family' ] || ENV [ 'retina' ]
100
+ simctl = File . join ( App . config . xcode_dir , 'Platforms/iPhoneSimulator.platform/Developer/usr/bin/simctl' )
101
+ App . fail "Starting with Xcode 6 / iOS Simulator 8, the `device_family' " \
102
+ "and `retina' options are no longer valid. Instead, use the " \
103
+ "`device_name' option which takes the name of one of the " \
104
+ "configured device-sets found in Xcode -> Window -> Devices " \
105
+ "or under `Devices' in the output of: $ #{ simctl } list"
106
+ end
107
+ else
91
108
if family = ENV [ 'device_family' ]
92
- App . config . device_family_int ( family . downcase . intern )
93
- else
94
- App . config . device_family_ints [ 0 ]
109
+ family_int = App . config . device_family_int ( family . downcase . intern )
95
110
end
96
111
97
- retina = ENV [ 'retina' ]
98
- if retina && retina . strip . downcase == 'false' && family_int == 1 # iPhone only
99
- ios_7 = Motion ::Util ::Version . new ( '7' )
100
- if Motion ::Util ::Version . new ( target ) >= ios_7
101
- if deployment_target < ios_7
102
- App . fail "In order to simulate on a non-retina device, please use " \
103
- "the `target' option to specify the simulated SDK version. " \
104
- "E.g.: rake target=#{ deployment_target } retina=false"
105
- else
106
- App . fail "It is not possible to simulate on a non-retina device " \
107
- "when not deploying to iOS < 7."
112
+ retina = ENV [ 'retina' ]
113
+ if retina && retina . strip . downcase == 'false' && family_int == 1 # iPhone only
114
+ ios_7 = Motion ::Util ::Version . new ( '7' )
115
+ if Motion ::Util ::Version . new ( target ) >= ios_7
116
+ if deployment_target < ios_7
117
+ App . fail "In order to simulate on a non-retina device, please use " \
118
+ "the `target' option to specify the simulated SDK version. " \
119
+ "E.g.: rake target=#{ deployment_target } retina=false"
120
+ else
121
+ App . fail "It is not possible to simulate on a non-retina device " \
122
+ "when not deploying to iOS < 7."
123
+ end
108
124
end
109
125
end
110
126
end
0 commit comments