Skip to content

Commit

Permalink
* fixed: idea run configuration -- preferred simulator type was not w…
Browse files Browse the repository at this point in the history
…orking (MobiVM#768)

Root cases:
- there is no more default `iPhone 8` in recent xcodes.
- have to check for prefix instead of exact match (as there is usually revision suffix)

(cherry picked from commit 0e4b162)
  • Loading branch information
dkimitsa committed Apr 12, 2024
1 parent ac0b2d7 commit 26a69d9
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,10 @@
*/
public class DeviceType implements Comparable<DeviceType> {
public static final String IOS_VERSION_PREFIX = "com.apple.CoreSimulator.SimRuntime.iOS-";
public static final String PREFERRED_IPHONE_SIM_NAME = "iPhone 8";
public static final String PREFERRED_IPHONE_SIM_NAME = "iPhone SE";
public static final String PREFERRED_IPAD_SIM_NAME = "iPad Air";

public static final String[] ONLY_32BIT_DEVICES = {"iPhone 4", "iPhone 4s", "iPhone 5", "iPhone 5c", "iPad 2"};
public static final Version ONLY_64BIT_IOS_VERSION = new Version(11, 0, 0);
public static final Version ARM64_IOS_VERSION = new Version(14, 0, 0);

public enum DeviceFamily {
Expand Down Expand Up @@ -309,7 +308,7 @@ public static DeviceType getBestDeviceType(Arch arch, DeviceFamily family,
// match for specified device
if (exact == null || (version == null && type.version.versionCode > exact.version.versionCode))
exact = type;
} else if (deviceName == null && type.getDeviceName().equals(preferredDeviceName)) {
} else if (deviceName == null && type.getDeviceName().startsWith(preferredDeviceName)) {
// match for preferable device
if (bestDefault == null || (version == null && type.version.versionCode > bestDefault.version.versionCode))
bestDefault = type;
Expand Down

0 comments on commit 26a69d9

Please sign in to comment.