Skip to content

Commit 2042b8d

Browse files
Fix debugging for simulator when --emulator is not passed
When --emulator is not passed, CLI will try to debug on iOS Simulator in case there's one started (or CLI will start it). However the iOS debug service calls methods for debug on device and it fails. Use correct methods when the detected devices is emulator.
1 parent 7553ab5 commit 2042b8d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/services/ios-debug-service.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class IOSDebugService implements IDebugService {
6868
public debugStart(): IFuture<void> {
6969
return (() => {
7070
this.$devicesService.initialize({ platform: this.platform, deviceId: this.$options.device }).wait();
71-
this.$devicesService.execute((device: Mobile.IiOSDevice) => this.debugBrkCore(device)).wait();
71+
this.$devicesService.execute((device: Mobile.IiOSDevice) => device.isEmulator ? this.emulatorDebugBrk() : this.debugBrkCore(device)).wait();
7272
}).future<void>()();
7373
}
7474

@@ -112,6 +112,9 @@ class IOSDebugService implements IDebugService {
112112
return (() => {
113113
this.$devicesService.initialize({ platform: this.platform, deviceId: this.$options.device }).wait();
114114
this.$devicesService.execute((device: iOSDevice.IOSDevice) => (() => {
115+
if(device.isEmulator) {
116+
return this.emulatorDebugBrk().wait();
117+
}
115118
// we intentionally do not wait on this here, because if we did, we'd miss the AppLaunching notification
116119
let deploy = this.$platformService.deployOnDevice(this.platform);
117120
this.debugBrkCore(device).wait();
@@ -133,7 +136,7 @@ class IOSDebugService implements IDebugService {
133136
private deviceStart(): IFuture<void> {
134137
return (() => {
135138
this.$devicesService.initialize({ platform: this.platform, deviceId: this.$options.device }).wait();
136-
this.$devicesService.execute((device: Mobile.IiOSDevice) => this.deviceStartCore(device)).wait();
139+
this.$devicesService.execute((device: Mobile.IiOSDevice) => device.isEmulator ? this.emulatorStart() : this.deviceStartCore(device)).wait();
137140
}).future<void>()();
138141
}
139142

0 commit comments

Comments
 (0)