Skip to content

Commit cbdcaca

Browse files
Pass correct args to ios-sim-portable's stopApplication
When Xcode 8 or later is installed, ios-sim-portable will spawn `xcrun simctl terminate <device id> <app id>` in order to stop the application. For earlier version the command for stopping the app is `killall <app name>`. So pass correct args to the method.
1 parent b16ad07 commit cbdcaca

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

lib/commands/debug.ts

+3-8
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ export abstract class DebugPlatformCommand implements ICommand {
66
constructor(private debugService: IPlatformDebugService,
77
private $devicesService: Mobile.IDevicesService,
88
private $injector: IInjector,
9-
private $devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
109
private $config: IConfiguration,
1110
private $usbLiveSyncService: ILiveSyncService,
1211
private $debugDataService: IDebugDataService,
@@ -49,11 +48,7 @@ export abstract class DebugPlatformCommand implements ICommand {
4948
await this.debugService.debugStop();
5049

5150
let applicationId = deviceAppData.appIdentifier;
52-
if (deviceAppData.device.isEmulator && deviceAppData.platform.toLowerCase() === this.$devicePlatformsConstants.iOS.toLowerCase()) {
53-
applicationId = projectData.projectName;
54-
}
55-
56-
await deviceAppData.device.applicationManager.stopApplication(applicationId);
51+
await deviceAppData.device.applicationManager.stopApplication(applicationId, projectData.projectName);
5752

5853
const buildConfig: IBuildConfig = _.merge({ buildForDevice: !deviceAppData.device.isEmulator }, deployOptions);
5954
debugData.pathToAppPackage = this.$platformService.lastOutputPath(this.debugService.platform, buildConfig, projectData);
@@ -102,7 +97,7 @@ export class DebugIOSCommand extends DebugPlatformCommand {
10297
$projectData: IProjectData,
10398
$platformsData: IPlatformsData,
10499
$iosDeviceOperations: IIOSDeviceOperations) {
105-
super($iOSDebugService, $devicesService, $injector, $devicePlatformsConstants, $config, $usbLiveSyncService, $debugDataService, $platformService, $projectData, $options, $platformsData, $logger);
100+
super($iOSDebugService, $devicesService, $injector, $config, $usbLiveSyncService, $debugDataService, $platformService, $projectData, $options, $platformsData, $logger);
106101
// Do not dispose ios-device-lib, so the process will remain alive and the debug application (NativeScript Inspector or Chrome DevTools) will be able to connect to the socket.
107102
// In case we dispose ios-device-lib, the socket will be closed and the code will fail when the debug application tries to read/send data to device socket.
108103
// That's why the `$ tns debug ios --justlaunch` command will not release the terminal.
@@ -136,7 +131,7 @@ export class DebugAndroidCommand extends DebugPlatformCommand {
136131
$options: IOptions,
137132
$projectData: IProjectData,
138133
$platformsData: IPlatformsData) {
139-
super($androidDebugService, $devicesService, $injector, $devicePlatformsConstants, $config, $usbLiveSyncService, $debugDataService, $platformService, $projectData, $options, $platformsData, $logger);
134+
super($androidDebugService, $devicesService, $injector, $config, $usbLiveSyncService, $debugDataService, $platformService, $projectData, $options, $platformsData, $logger);
140135
}
141136

142137
public async canExecute(args: string[]): Promise<boolean> {

0 commit comments

Comments
 (0)