Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion packages/cli-platform-ios/src/commands/logIOS/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ async function logIOS(_argv: Array<string>, _ctx: Config, args: Args) {
({type, isAvailable}) => type === 'simulator' && isAvailable,
);

if (availableSimulators.length === 0) {
logger.error('No simulators detected. Install simulators via Xcode.');
return;
}

const bootedAndAvailableSimulators = bootedSimulators.map((booted) => {
const available = availableSimulators.find(
({udid}) => udid === booted.udid,
Expand All @@ -44,7 +49,7 @@ async function logIOS(_argv: Array<string>, _ctx: Config, args: Args) {
});

if (bootedAndAvailableSimulators.length === 0) {
logger.error('No active iOS device found');
logger.error('No booted and available iOS simulators found.');
return;
}

Expand Down
15 changes: 13 additions & 2 deletions packages/cli-platform-ios/src/commands/runIOS/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,18 @@ async function runIOS(_: Array<string>, ctx: Config, args: FlagsT) {

const {mode, scheme} = await getConfiguration(xcodeProject, sourceDir, args);

const availableDevices = await listIOSDevices();
const devices = await listIOSDevices();

const availableDevices = devices.filter(
({isAvailable}) => isAvailable === true,
);

if (availableDevices.length === 0) {
return logger.error(
'iOS devices or simulators not detected. Install simulators via Xcode or connect a physical iOS device',
);
}

if (args.listDevices || args.interactive) {
if (args.device || args.udid) {
logger.warn(
Expand All @@ -126,7 +137,7 @@ async function runIOS(_: Array<string>, ctx: Config, args: FlagsT) {

if (!args.device && !args.udid && !args.simulator) {
const bootedDevices = availableDevices.filter(
({type, isAvailable}) => type === 'device' && isAvailable,
({type}) => type === 'device',
);

const simulators = getSimulators();
Expand Down