@@ -147,11 +147,22 @@ export class WebKitDebugAdapter implements DebugProtocol.IDebugAdapter {
147
147
Services . logger ( ) . log ( '[NSDebugAdapter] Running tns command...' , Tags . FrontendMessage ) ;
148
148
let cliCommand : DebugResult ;
149
149
if ( this . _request . isLaunch ) {
150
- let teamId = this . getTeamId ( Services . appRoot , this . _request . args . tnsArgs ) ;
151
- if ( ! teamId ) {
152
- teamId = ( await Services . extensionClient ( ) . selectTeam ( ) ) . id ;
150
+ let tnsArgs = this . _request . args . tnsArgs ;
151
+
152
+ // For iOS the TeamID is required if there's more than one.
153
+ // Therefore if not set, show selection to the user.
154
+ if ( args . platform && args . platform . toLowerCase ( ) === 'ios' ) {
155
+ let teamId = this . getTeamId ( path . join ( Services . appRoot , 'app' ) , this . _request . args . tnsArgs ) ;
156
+ if ( ! teamId ) {
157
+ let selectedTeam = ( await Services . extensionClient ( ) . selectTeam ( ) ) ;
158
+ if ( selectedTeam ) {
159
+ // add the selected by the user Team Id
160
+ tnsArgs = ( tnsArgs || [ ] ) . concat ( [ '--teamId' , selectedTeam . id ] ) ;
161
+ }
162
+ }
153
163
}
154
- cliCommand = this . _request . project . debug ( { stopOnEntry : this . _request . launchArgs . stopOnEntry , watch : this . _request . launchArgs . watch } , this . _request . args . tnsArgs ) ;
164
+
165
+ cliCommand = this . _request . project . debug ( { stopOnEntry : this . _request . launchArgs . stopOnEntry , watch : this . _request . launchArgs . watch } , tnsArgs ) ;
155
166
}
156
167
else if ( this . _request . isAttach ) {
157
168
cliCommand = this . _request . project . attach ( this . _request . args . tnsArgs ) ;
@@ -712,8 +723,8 @@ export class WebKitDebugAdapter implements DebugProtocol.IDebugAdapter {
712
723
}
713
724
714
725
private readXCConfig ( appRoot : string , flag : string ) : string {
715
- let xcconfigFile = path . join ( appRoot , "App_Resources/ios /build.xcconfig" ) ;
716
- if ( fs . exists ( xcconfigFile ) ) {
726
+ let xcconfigFile = path . join ( appRoot , "App_Resources/iOS /build.xcconfig" ) ;
727
+ if ( fs . existsSync ( xcconfigFile ) ) {
717
728
let text = fs . readFileSync ( xcconfigFile , { encoding : 'utf8' } ) ;
718
729
let teamId : string ;
719
730
text . split ( / \r ? \n / ) . forEach ( ( line ) => {
@@ -731,7 +742,7 @@ export class WebKitDebugAdapter implements DebugProtocol.IDebugAdapter {
731
742
}
732
743
733
744
let fileName = path . join ( appRoot , "teamid" ) ;
734
- if ( fs . exists ( fileName ) ) {
745
+ if ( fs . existsSync ( fileName ) ) {
735
746
return fs . readFileSync ( fileName , { encoding : 'utf8' } ) ;
736
747
}
737
748
0 commit comments