Skip to content

Commit

Permalink
fix #1381
Browse files Browse the repository at this point in the history
  • Loading branch information
pavjacko committed Feb 6, 2024
1 parent c5ea85c commit 0c651ae
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/sdk-apple/src/deviceManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
logSuccess,
} from '@rnv/core';
import { AppiumAppleDevice, AppleDevice } from './types';
import { execFileSync } from 'child_process';

export const getAppleDevices = async (c: RnvContext, ignoreDevices?: boolean, ignoreSimulators?: boolean) => {
const { platform } = c;
Expand Down Expand Up @@ -224,6 +225,17 @@ const _launchSimulator = async (selectedDevice: AppleDevice) => {
return false;
}

// We need to have simulator app launched for "xcrun simctl boot" to take effect
const developerDir = execFileSync('xcode-select', ['-p'], {
encoding: 'utf8',
}).trim();
execFileSync('open', [
`${developerDir}/Applications/Simulator.app`,
'--args',
'-CurrentDeviceUDID',
selectedDevice.udid,
]);

await executeAsync(`xcrun simctl boot ${selectedDevice.udid}`, ExecOptionsPresets.NO_SPINNER_FULL_ERROR_SUMMARY);
logSuccess(`Succesfully launched ${selectedDevice.name}`);
return true;
Expand Down

0 comments on commit 0c651ae

Please sign in to comment.