Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions packages/platform-ios/src/commands/runIOS/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,20 @@ async function runOnSimulator(xcodeProject, scheme, args: FlagsT) {
}

async function runOnDevice(selectedDevice, scheme, xcodeProject, args: FlagsT) {
const isIOSDeployInstalled = child_process.spawnSync(
'ios-deploy',
['--version'],
{encoding: 'utf8'},
);

if (isIOSDeployInstalled.error) {
throw new CLIError(
`Failed to install the app on the device because we couldn't execute the "ios-deploy" command. Please install it by running "${chalk.bold(
'npm install -g ios-deploy',
)}" and try again.`,
);
}

const appName = await buildProject(
xcodeProject,
selectedDevice.udid,
Expand All @@ -214,12 +228,14 @@ async function runOnDevice(selectedDevice, scheme, xcodeProject, args: FlagsT) {
);

if (iosDeployOutput.error) {
logger.error(
'** INSTALLATION FAILED **\nMake sure you have ios-deploy installed globally.\n(e.g "npm install -g ios-deploy")',
throw new CLIError(
`Failed to install the app on the device. We've encountered an error in "ios-deploy" command: ${
iosDeployOutput.error.message
}`,
);
} else {
logger.info('** INSTALLATION SUCCEEDED **');
}

return logger.success('Installed the app on the device.');
}

function buildProject(xcodeProject, udid, scheme, args: FlagsT) {
Expand Down