Skip to content

Commit c0f761b

Browse files
Merge pull request #93 from telerik/vladimirov/fix-run
Fix starting default simulator
2 parents 460f2b2 + 19c0501 commit c0f761b

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

lib/iphone-simulator-xcode-simctl.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export class XCodeSimctlSimulator extends IPhoneSimulatorNameGetter implements I
9393
try {
9494
const xcodeVersion = xcode.getXcodeVersionData();
9595
xcodeMajorVersion = +xcodeVersion.major;
96-
} catch(err) {
96+
} catch (err) {
9797
// Ignore the error.
9898
}
9999

@@ -165,7 +165,10 @@ export class XCodeSimctlSimulator extends IPhoneSimulatorNameGetter implements I
165165
public startSimulator(device?: IDevice): void {
166166
device = device || this.getDeviceToRun();
167167

168-
this.verifyDevice(device);
168+
// In case the id is undefined, skip verification - we'll start default simulator.
169+
if (device.id) {
170+
this.verifyDevice(device);
171+
}
169172

170173
if (!this.isDeviceBooted(device)) {
171174
let bootedDevice = this.getBootedDevice();
@@ -181,9 +184,8 @@ export class XCodeSimctlSimulator extends IPhoneSimulatorNameGetter implements I
181184
}
182185
}
183186

184-
private verifyDevice(device?: IDevice): void {
187+
private verifyDevice(device: IDevice): void {
185188
const availableDevices = this.getDevices();
186-
187189
if (!_.find(availableDevices, { id: device.id })) {
188190
errors.fail(`No simulator image available for device identifier '${device.id}'.`);
189191
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ios-sim-portable",
3-
"version": "3.1.0",
3+
"version": "3.1.1",
44
"description": "",
55
"main": "./lib/ios-sim.js",
66
"scripts": {

0 commit comments

Comments
 (0)