@@ -29,7 +29,8 @@ export class IOSDebugService extends DebugServiceBase implements IPlatformDebugS
2929 private $iOSSocketRequestExecutor : IiOSSocketRequestExecutor ,
3030 private $processService : IProcessService ,
3131 private $socketProxyFactory : ISocketProxyFactory ,
32- private $projectDataService : IProjectDataService ) {
32+ private $projectDataService : IProjectDataService ,
33+ private $deviceLogProvider : Mobile . IDeviceLogProvider ) {
3334 super ( device , $devicesService ) ;
3435 this . $processService . attachToProcessExitSignals ( this , this . debugStop ) ;
3536 this . $socketProxyFactory . on ( CONNECTION_ERROR_EVENT_NAME , ( e : Error ) => this . emit ( CONNECTION_ERROR_EVENT_NAME , e ) ) ;
@@ -40,8 +41,6 @@ export class IOSDebugService extends DebugServiceBase implements IPlatformDebugS
4041 }
4142
4243 public async debug ( debugData : IDebugData , debugOptions : IDebugOptions ) : Promise < string > {
43- await this . device . openDeviceLogStream ( ) ;
44-
4544 if ( debugOptions . debugBrk && debugOptions . start ) {
4645 this . $errors . failWithoutHelp ( "Expected exactly one of the --debug-brk or --start options." ) ;
4746 }
@@ -50,6 +49,20 @@ export class IOSDebugService extends DebugServiceBase implements IPlatformDebugS
5049 debugOptions . emulator = true ;
5150 }
5251
52+ if ( ! debugOptions . justlaunch ) {
53+ let projectName = debugData . projectName ;
54+ if ( ! projectName && debugData . projectDir ) {
55+ const projectData = this . $projectDataService . getProjectData ( debugData . projectDir ) ;
56+ projectName = projectData . projectName ;
57+ }
58+
59+ if ( projectName ) {
60+ this . $deviceLogProvider . setProjectNameForDevice ( debugData . deviceIdentifier , projectName ) ;
61+ }
62+
63+ await this . device . openDeviceLogStream ( ) ;
64+ }
65+
5366 if ( debugOptions . emulator ) {
5467 if ( debugOptions . start ) {
5568 return this . emulatorStart ( debugData , debugOptions ) ;
@@ -108,7 +121,7 @@ export class IOSDebugService extends DebugServiceBase implements IPlatformDebugS
108121
109122 private async emulatorDebugBrk ( debugData : IDebugData , debugOptions : IDebugOptions ) : Promise < string > {
110123 const args = debugOptions . debugBrk ? "--nativescript-debug-brk" : "--nativescript-debug-start" ;
111- const launchResult = await this . $iOSEmulatorServices . runApplicationOnEmulator ( debugData . pathToAppPackage , {
124+ const launchResult = await this . $iOSEmulatorServices . runApplicationOnEmulator ( debugData . pathToAppPackage , {
112125 waitForDebugger : true ,
113126 captureStdin : true ,
114127 args : args ,
0 commit comments