From a68d20921c992e948e3958abf7e7e251a29ef320 Mon Sep 17 00:00:00 2001 From: Dan Tamas Date: Fri, 15 Oct 2021 18:20:53 +0200 Subject: [PATCH 1/3] Fix bootSimulator to use simclt instead of deprecated instruments Should fix #1474 and https://github.com/facebook/react-native/issues/32255#issuecomment-932039063 --- packages/platform-ios/src/commands/runIOS/index.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/platform-ios/src/commands/runIOS/index.ts b/packages/platform-ios/src/commands/runIOS/index.ts index 9a8936f7a..00853441e 100644 --- a/packages/platform-ios/src/commands/runIOS/index.ts +++ b/packages/platform-ios/src/commands/runIOS/index.ts @@ -399,11 +399,17 @@ function bootSimulator(selectedSimulator: Device) { logger.info(`Launching ${simulatorFullName}`); try { child_process.spawnSync('xcrun', [ - 'instruments', - '-w', + 'simctl', + 'boot', selectedSimulator.udid, ]); } catch (_ignored) { + // before Xcode 13 we wre using + // child_process.spawnSync('xcrun', [ + // 'instruments', + // '-w', + // selectedSimulator.udid, + // ]); // instruments always fail with 255 because it expects more arguments, // but we want it to only launch the simulator } From d9465d54e444897b5e9e33cacc99adfdbe81bce6 Mon Sep 17 00:00:00 2001 From: Dan Tamas Date: Mon, 18 Oct 2021 09:02:51 +0200 Subject: [PATCH 2/3] Remove try/catch after removing instruments --- .../platform-ios/src/commands/runIOS/index.ts | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/packages/platform-ios/src/commands/runIOS/index.ts b/packages/platform-ios/src/commands/runIOS/index.ts index 00853441e..a28d6a3ef 100644 --- a/packages/platform-ios/src/commands/runIOS/index.ts +++ b/packages/platform-ios/src/commands/runIOS/index.ts @@ -397,22 +397,12 @@ function buildProject( function bootSimulator(selectedSimulator: Device) { const simulatorFullName = formattedDeviceName(selectedSimulator); logger.info(`Launching ${simulatorFullName}`); - try { - child_process.spawnSync('xcrun', [ - 'simctl', - 'boot', - selectedSimulator.udid, - ]); - } catch (_ignored) { - // before Xcode 13 we wre using - // child_process.spawnSync('xcrun', [ - // 'instruments', - // '-w', - // selectedSimulator.udid, - // ]); - // instruments always fail with 255 because it expects more arguments, - // but we want it to only launch the simulator - } + + child_process.spawnSync('xcrun', [ + 'simctl', + 'boot', + selectedSimulator.udid, + ]); } function getTargetPaths(buildSettings: string) { From 531040a8401e1a06c63ecb1eb33254a936da359b Mon Sep 17 00:00:00 2001 From: Dan Tamas Date: Mon, 18 Oct 2021 09:17:18 +0200 Subject: [PATCH 3/3] linting --- packages/platform-ios/src/commands/runIOS/index.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/platform-ios/src/commands/runIOS/index.ts b/packages/platform-ios/src/commands/runIOS/index.ts index a28d6a3ef..32fec787b 100644 --- a/packages/platform-ios/src/commands/runIOS/index.ts +++ b/packages/platform-ios/src/commands/runIOS/index.ts @@ -398,11 +398,7 @@ function bootSimulator(selectedSimulator: Device) { const simulatorFullName = formattedDeviceName(selectedSimulator); logger.info(`Launching ${simulatorFullName}`); - child_process.spawnSync('xcrun', [ - 'simctl', - 'boot', - selectedSimulator.udid, - ]); + child_process.spawnSync('xcrun', ['simctl', 'boot', selectedSimulator.udid]); } function getTargetPaths(buildSettings: string) {