From 45666c7476b62f22e1f210e55e1fa31359d8165d Mon Sep 17 00:00:00 2001 From: Adam Ernst Date: Tue, 7 May 2024 08:50:00 -0700 Subject: [PATCH] Fix incorrect os version for simulators Reviewed By: lawrencelomax Differential Revision: D57011949 fbshipit-source-id: 34ab6ec8c8aec6afc275fda588f9218be16ad4fb --- FBSimulatorControl/Configuration/FBSimulatorConfiguration.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/FBSimulatorControl/Configuration/FBSimulatorConfiguration.m b/FBSimulatorControl/Configuration/FBSimulatorConfiguration.m index bf339c754..0ffa0f2bc 100644 --- a/FBSimulatorControl/Configuration/FBSimulatorConfiguration.m +++ b/FBSimulatorControl/Configuration/FBSimulatorConfiguration.m @@ -128,9 +128,11 @@ - (instancetype)withOS:(FBOSVersion *)os - (instancetype)withDevice:(FBDeviceType *)device { NSParameterAssert(device); - // Use the current os if compatible + // Use the current os if compatible. + // If os.families is empty, it was probably created via [FBOSVersion +genericWithName:] + // which has no information about families; in that case we assume it is compatible. FBOSVersion *os = self.os; - if ([os.families containsObject:@(device.family)]) { + if (!os.families.count || [os.families containsObject:@(device.family)]) { return [[FBSimulatorConfiguration alloc] initWithNamedDevice:device os:os]; } // Attempt to find the newest OS for this device, otherwise use what we had before.